c# - Exception handling in ContinueWith called infinitely -
I'm an async method call (particularly: Microsoft.ServiceBus.Messaging.QueueClient.SendAsync ()) and Want to be . Within able to handle exceptions One possibility would have come across I: However, it seems to ContinueWith called limitless: Any idea why this happens and how to get around this? Thank you I was a TraceListener which will take Debug.WriteLine and The reason for the loop was calling to send in. The implication is that a TraceListener hears for the mark, but it also seems to listen to the debug message too.
_queueClient.SendAsync (message) .ContinueWith ((t) = & gt; { debug. WriteLine ( "exception:". + t.Exception.InnerException.GetType () name);}, TaskContinuationOptions.OnlyOnFaulted);
exception: UnauthorizedAccessException exception: UnauthorizedAccessException exception: UnauthorizedAccessException exception: UnauthorizedAccessException exception: UnauthorizedAccessException exception: UnauthorizedAccessException ................................... ...... etc < / Pre>
Comments
Post a Comment