Monday 15 June 2015

c# - Exception handling in ContinueWith called infinitely -



c# - Exception handling in ContinueWith called infinitely -

i'm calling async method (specifically: microsoft.servicebus.messaging.queueclient.sendasync()) , want able handle exceptions within.

one possibility have come across is:

_queueclient.sendasync(message).continuewith((t) => { debug.writeline("exception: " + t.exception.innerexception.gettype().name); }, taskcontinuationoptions.onlyonfaulted);

however continuewith seems called infinitely:

exception: unauthorizedaccessexception exception: unauthorizedaccessexception exception: unauthorizedaccessexception exception: unauthorizedaccessexception exception: unauthorizedaccessexception exception: unauthorizedaccessexception ...................................... ......etc

any ideas why happens , how around it?

thanks

i calling send within tracelistener picking debug.writeline , causing loop.

the implication tracelistener listens traces, seems listens debug messages well.

c# asp.net exception-handling task continuations

No comments:

Post a Comment