Skip to content

Commit

Permalink
COREX-346 CoreDataService keeps crashing (#24)
Browse files Browse the repository at this point in the history
- Call Abort on communicationObject when disposing AnnouncementClient in case it is in Faulted state
  • Loading branch information
raffii90 authored Mar 12, 2024
1 parent 8a2a871 commit cb17b44
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.ServiceModel;
using System.ServiceModel.Discovery;

namespace EMG.Utilities.ServiceModel.Discovery
Expand All @@ -24,7 +25,16 @@ public void AnnounceOffline(EndpointDiscoveryMetadata metadata)

public void Dispose()
{
((IDisposable)_client).Dispose();
var communicationObject = _client as ICommunicationObject;

if (communicationObject.State != CommunicationState.Faulted)
{
((IDisposable)_client).Dispose();
}
else
{
communicationObject.Abort();
}
}
}
}

0 comments on commit cb17b44

Please sign in to comment.