everyone
I am writing a C# application that handles all uncaught exceptions in the main routine:
static void Main()
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainFrame());
}
catch (Exception e)
{
CrashReporter.Report(e);
}
}
And when I am running the application (even Release build) from visual studio it works. But when I publish it as click-once and install, in most of the cases, the exceptions won't be caught in the Main function. And the exception stack is something like this:
...
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I.e. Main is not even in the stack... Why does that happen? Is there any way to do such 'catch all' thing? Why is published vs local build behavior different?
Thanks in advance Serge