Skip to content

Commit 9e26f6f

Browse files
authored
Serialiser_Engine: fix for MessageForDeleted to be picked up for properties of types that have multiple matching types (#3371)
2 parents 85617f9 + b067771 commit 9e26f6f

File tree

2 files changed

+6
-7
lines changed
  • BHoM_Engine/Create/Type
  • Serialiser_Engine/Compute/Deserialise

2 files changed

+6
-7
lines changed

BHoM_Engine/Create/Type/Type.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,14 @@ public static Type Type(string name, bool silent = false, bool takeFirstIfMultip
7878
else if (types.Count == 1)
7979
return types[0];
8080
else if (types.Count > 1 && takeFirstIfMultiple)
81-
return types.OrderBy(x => x.Assembly.FullName).First();
82-
else if (!silent)
8381
{
84-
string message = "Ambiguous match: Multiple types correspond the the name provided: \n";
85-
foreach (Type type in types)
86-
message += "- " + type.FullName + "\n";
82+
if (!silent)
83+
Compute.RecordWarning($"Ambiguous match: Multiple types correspond the the name provided:\n{string.Join("\n", types.Select(x => x.FullName))}");
8784

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

9190
return null;
9291
}

Serialiser_Engine/Compute/Deserialise/Type.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private static Type DeserialiseType(this BsonValue bson, Type value, string vers
4646
return null;
4747
else if (bson.IsString)
4848
{
49-
Type type = BH.Engine.Base.Create.Type(bson.AsString, true);
49+
Type type = BH.Engine.Base.Create.Type(bson.AsString, true, true);
5050
if (type != null)
5151
return type;
5252
else

0 commit comments

Comments
 (0)