Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

application level global exception handler didn't get hit

My .net application has a global exception handler by subscribing to AppDomain.Current.Domain UnhandledException event. On a few occassions i have seen that my application crashes but this global exception handler never gets hit. Not sure if its help but application is doing some COM interop.

My understanding is that as long as I don't have any local catch blocks swallowing the exception, this global exception handler should always be hit. Any ideas on what I might be missing causing this handler never been invoked?

like image 298
palm snow Avatar asked Mar 13 '11 16:03

palm snow


People also ask

What happens if there is no handler for a specific exception?

If no exception handler for a given exception is present, the program stops executing with an error message. Don't catch an exception unless you can handle it and leave the application in a known state.

How do you handle exceptions at application level?

In any typical application, Exceptions are generally handled at the code level using try-catch blocks. If the code does not have a try and catch block for the occurred exception then it propagates to the page level, at page level the Page_Error routine can be used to handle the exception.

How does global exception handler work?

When using the Global Exception Handler with a project that includes a Try Catch, make sure to group activities into a Sequence inside the Try container. Otherwise, the Global Exception Handler does not execute. In the case of nested activities, the Global Exception Handler executes for each activity in the call stack.

How do you handle exceptions in spring boot globally?

You can define the @ExceptionHandler method to handle the exceptions as shown. This method should be used for writing the Controller Advice class file. Now, use the code given below to throw the exception from the API. The complete code to handle the exception is given below.


1 Answers

Is this the cause of your problem?

AppDomain.CurrentDomain.UnhandledException not firing without debugging

like image 129
Beaker Avatar answered Sep 27 '22 23:09

Beaker