Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialiser_Engine: fix for MessageForDeleted to be picked up for properties of types that have multiple matching types #3371

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading