Based on documentation and articles it is recommended to call Abort() on a client proxy if an unexpected exception/fault is encountered. See the following (simplified):
MyServiceClient proxy = null;
try {
proxy = new MyServiceClient();
proxy.DoSomething();
proxy.Close();
} catch (Exception ex) {
if (proxy != null)
proxy.Abort();
}
Is there any possibility of the call to Abort() throwing an exception itself? Should the call to Abort() be within its own try/catch?
No, Abort will not fail (but .Close() or .Dispose() might). Calling .Abort() is the "sledgehammer" approach to terminating a channel - it's just torn down, regardless of an ongoing message handling.
Use it only carefully - e.g. in a exception catch case when calling .Close() failed. That's it's real purpose and proper use.
Marc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With