Line numbers in event viewer

I am getting an exception in the windows service I'm working on. It does not fall into any of my try / catch blocks (which I have everywhere), but I see this in the Windows event log. Is there a way to make an exception in the event log include line numbers?

+4
source share
1 answer

Subscribe to the AppDomain.CurrentDomain.UnhandledException event and you will not miss the unhandled exception:

 public static void Main() { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; // Service Run } static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { // log exception e.ExceptionObject } 
+3
source

All Articles