I have installed a C# windows forms app on a client machine which does not have Visual Studio installed.
When the application is run, it immediately crashes with a dialog which says
ProgramX has stopped working. A problem caused the program to stop working correctly. Please close the program."
The only button on the dialog is "close the program".
I would like to see the exception message and stack trace so that I can diagnose the issue.
I have tried installing the .Net SDK, which comes with "windbg". I have run the program in windbg, and managed to get it to say "CLR exception". However, I cannot get windbg to print the exception message or stack trace. It will not load SOS or PSSCOR2, because of DLL loading messages, even after lots of fiddling. There must be an easier way!
(If your answer involves windbg, please include detailed step by step instructions as I have tried and failed at this approach.)
The application is a .Net 3.5 app. The machine has .Net 3.5 and .Net 4 installed. There is nothing in the event log (that I can find).
If you do NOT have access to source code then you have a problem. Exceptions should finish in windows events. Maybe exception is being suppressed.
If you DO have access to source code you can surround starting code with TRY\CATCH and in CATCH and print exception info to a file:
Code
try
{
//Your code
}
catch (Exception ex)
{
//Log info to a file in same directory
}
You can catch unhandled exceptions in one place in your code by adding a handler to the following event. You can then log or perform some other action.
AppDomain.UnhandledException
You can generate a crash dump from Task Manager (right-click on an entry in the Processes
tab and select Create Dump File
) and load it with WinDbg. Running the !pe
command should display the exception. You will need the PDB files from your build and the correct version of the SOS DLL from the machine that crashed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With