Exception handling....
-
Excuse me for a quick noob question: Let's say a component of my C# application throws and exception. I want to catch it and handle it, but! I have
try...catch
in program.cs around the wholeApplication.Run(new FormMain());
and yet the system itself somehow pops the "application error" dialog with the whole backtrace and all. I'm guessing it's catching the exception sooner somewhere handling my FormMain execution. Where would I then place the whole form wide exception handling to intercept it before the .NET code? 3.1415 -
Excuse me for a quick noob question: Let's say a component of my C# application throws and exception. I want to catch it and handle it, but! I have
try...catch
in program.cs around the wholeApplication.Run(new FormMain());
and yet the system itself somehow pops the "application error" dialog with the whole backtrace and all. I'm guessing it's catching the exception sooner somewhere handling my FormMain execution. Where would I then place the whole form wide exception handling to intercept it before the .NET code? 3.1415I might be missing something, but it sounds like .NET can catch the exception raised in your code before you can. If you don't know where exactly the exception could be raised, you needn't do anything. If you do know the exact code segment, try to catch and handle the exception before .NET does.
Best, Jun
-
Excuse me for a quick noob question: Let's say a component of my C# application throws and exception. I want to catch it and handle it, but! I have
try...catch
in program.cs around the wholeApplication.Run(new FormMain());
and yet the system itself somehow pops the "application error" dialog with the whole backtrace and all. I'm guessing it's catching the exception sooner somewhere handling my FormMain execution. Where would I then place the whole form wide exception handling to intercept it before the .NET code? 3.1415Try handling the AppDomain.UnhandledException event. However, you should find the cause of the exception and handle it at the point closest to where it is being thrown
only two letters away from being an asset