Make ConnectionComparer more resilient
This commit is contained in:
parent
f6f1d930e2
commit
2a7ca95456
|
|
@ -40,10 +40,5 @@
|
|||
<PackageReference Include="Proto.Persistence.Sqlite" Version="1.1.0"/>
|
||||
<PackageReference Include="Proto.Persistence.SqlServer" Version="1.3.1-alpha.0.2"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\DropIns\"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,13 @@ public class ConnectionComparer : IEqualityComparer<Connection>
|
|||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
if (x.GetType() != y.GetType()) return false;
|
||||
|
||||
// ReSharper disable ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
|
||||
// Justification: These can be null when the designer is in an invalid state. For example, if a NotFoundActivity is used that no longer has the same outcomes.
|
||||
if (x.Source.Activity?.Id == null || x.Target.Activity?.Id == null || y.Source.Activity?.Id == null || y.Target.Activity?.Id == null)
|
||||
return false;
|
||||
// ReSharper restore ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
|
||||
|
||||
return x.Source.Activity.Id.Equals(y.Source.Activity.Id) && x.Target.Activity.Id.Equals(y.Target.Activity.Id) && x.Source.Port == y.Source.Port && x.Target.Port == y.Target.Port;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue