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:

  _queueClient.SendAsync (message) .ContinueWith ((t) = & gt; { debug. WriteLine ( "exception:". + t.Exception.InnerException.GetType () name);}, TaskContinuationOptions.OnlyOnFaulted);   

However, it seems to ContinueWith called limitless:

  exception: UnauthorizedAccessException exception: UnauthorizedAccessException exception: UnauthorizedAccessException exception: UnauthorizedAccessException exception: UnauthorizedAccessException exception: UnauthorizedAccessException ................................... ...... etc  < / Pre> 

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.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -