diff --git a/BHoM_Engine/Create/Type/Type.cs b/BHoM_Engine/Create/Type/Type.cs index 9f94c7521..a93931e32 100644 --- a/BHoM_Engine/Create/Type/Type.cs +++ b/BHoM_Engine/Create/Type/Type.cs @@ -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; } diff --git a/Serialiser_Engine/Compute/Deserialise/Type.cs b/Serialiser_Engine/Compute/Deserialise/Type.cs index 6f5b75934..b767a8b81 100644 --- a/Serialiser_Engine/Compute/Deserialise/Type.cs +++ b/Serialiser_Engine/Compute/Deserialise/Type.cs @@ -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