Skip to content

Commit

Permalink
Serialiser_Engine: fix for MessageForDeleted to be picked up for prop…
Browse files Browse the repository at this point in the history
…erties of types that have multiple matching types (#3371)
  • Loading branch information
pawelbaran authored Jul 11, 2024
2 parents 85617f9 + b067771 commit 9e26f6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions BHoM_Engine/Create/Type/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,14 @@ public static Type Type(string name, bool silent = false, bool takeFirstIfMultip
else if (types.Count == 1)
return types[0];
else if (types.Count > 1 && takeFirstIfMultiple)
return types.OrderBy(x => x.Assembly.FullName).First();
else if (!silent)
{
string message = "Ambiguous match: Multiple types correspond the the name provided: \n";
foreach (Type type in types)
message += "- " + type.FullName + "\n";
if (!silent)
Compute.RecordWarning($"Ambiguous match: Multiple types correspond the the name provided:\n{string.Join("\n", types.Select(x => x.FullName))}");

Compute.RecordError(message);
return types.OrderBy(x => x.Assembly.FullName).First();
}
else if (!silent)
Compute.RecordError($"Ambiguous match: Multiple types correspond the the name provided:\n{string.Join("\n", types.Select(x => x.FullName))}");

return null;
}
Expand Down
2 changes: 1 addition & 1 deletion Serialiser_Engine/Compute/Deserialise/Type.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static Type DeserialiseType(this BsonValue bson, Type value, string vers
return null;
else if (bson.IsString)
{
Type type = BH.Engine.Base.Create.Type(bson.AsString, true);
Type type = BH.Engine.Base.Create.Type(bson.AsString, true, true);
if (type != null)
return type;
else
Expand Down

0 comments on commit 9e26f6f

Please sign in to comment.