I\'m trying to catch all unhandled exceptions in my worker role. I tried putting a try
-catch
block into the Run()
method (as suggested
The catch will catch all exceptions.
You are throwing it again so that one will not be caught.
Also you are logging, but logs are not turned on by default in Azure, since they cost.
The other alternative is that there is no exception.
As already updated in my question, here for completeness's sake as answer:
Obviously it is like in a normal c# application: Just add a handler to the UnhandledException
event like this
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
inside the OnStart()
of the Role.