Question How to debug application after an exception error?

Hugo1

New member
Joined
Feb 21, 2018
Messages
1
Programming Experience
Beginner
I wrote a C# application (.NET 4 Client Profile) which runs under Win64. Basically it works but from time to time I get an exception error message and the application crashes after I pressed
OK to the exception window.

The main problem is that it is difficult to locate problem in respect to my code I wrote because with the cryptic exception message I get. On the other hand it is a problem with a windows
driver (antiv virus scanner) and/or connected hardware on the same machine (PC).



Question:
What is the best way to isolate or find out where the problem is when I get such exception message again? Can I run a debugger or so to trace back in my code to locate the exact position
in my code?

Thanks in advance
 
The first thing to do would be to add a global exception handler to your application. You can then log the exception and use that information later. One of the important things is the stack trace, which will tell you exactly where the exception was thrown. You can then add some tracing code around that area to provide information about the application state that you can use the next time an exception is thrown. If you have VS installed on the machine running the application then you should be able to attach a debugger to the process.
 

Latest posts

Back
Top Bottom