I'm getting an exception in a windows service I'm working on. It isn't being caught by any of my try/catch blocks (which I have everywhere) but I can see it in the Windows Event Log. Is there a way to make the exception in the Event Log include line numbers?
Subscribe to AppDomain.CurrentDomain.UnhandledException
event and you will not miss 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
}