Skip to content

Commit

Permalink
Add proper protection for IsEquals check for Serialisation (#3443)
Browse files Browse the repository at this point in the history
  • Loading branch information
IsakNaslundBh authored Dec 12, 2024
2 parents 4eac991 + b64eafa commit 6feaefa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion .ci/code/Serialiser_Test/Verify/ObjectsToFromJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,19 @@ public static TestResult ObjectToFromJson(Type type)
Engine.Base.Compute.RecordError(e.Message);
}

if (!testObject.IsEqual(copy))
bool isEqual;

try
{
isEqual = testObject.IsEqual(copy);
}
catch (Exception e)
{
BH.Engine.Base.Compute.RecordError(e, $"Failed to compare the objcets of type {type.Name}");
isEqual = false;
}

if (!isEqual)
return new TestResult
{
Description = typeDescription,
Expand Down
2 changes: 1 addition & 1 deletion Diffing_Engine/Diffing_Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Exec Command="xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y&#xD;&#xA;&#xD;&#xA;xcopy &quot;$(TargetDir)KellermanSoftware.Compare-NET-Objects.dll&quot; &quot;C:\ProgramData\BHoM\Assemblies&quot; /Y" />
</Target>
<ItemGroup>
<PackageReference Include="CompareNETObjects" Version="4.67.0" />
<PackageReference Include="CompareNETObjects" Version="4.83.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BHoM_Engine\BHoM_Engine.csproj" />
Expand Down

0 comments on commit 6feaefa

Please sign in to comment.