Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to troubleshoot .NET application that just disappears?

Tags:

.net

debugging

One of our .NET 2.0 application started to just randomly disappear. There are no records in the Event log, Dr. Watson doesn't generate crash dump, no nothing...

How to troubleshoot this application?

like image 910
alex Avatar asked Oct 20 '09 13:10

alex


1 Answers

1) Attach an event handler to AppDomain.UnhandledException event and log the exception object.

AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

2) Attach a thread exception handler

Application.ThreadException +=
  new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

For WPF and Silverlight apps you use more exception handlers, e.g. Application.DispatcherUnhandledException and Application.UnhandledException respectively, but these are not of interest to you in this scenario. I include them for completeness.

like image 82
NT_ Avatar answered Nov 01 '22 15:11

NT_