Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug random crashes?

Tags:

c#

winforms

we have a dotnet 2.0 desktop winforms app and it seems to randomly crash. no stack trace, vent log, or anything. it just dissapears.

There are a few theories:

  1. machine simply runs out of resources. some people have said you will always get a window handle exception or a gdi exception but others say it might simply cause crashes.

  2. we are using wrappers around non managed code for 2 modules. exceptions inside either of these modules could cause this behavior.

again, this is not reproducible so i wanted to see if there were any suggestions on how to debug better or anything i can put on the machine to "catch" the crash before it happens to help us understand whats going on.

like image 540
leora Avatar asked Dec 13 '22 04:12

leora


2 Answers

Your best bet is to purchase John Robbins' book "Debugging Microsoft .NET 2.0 Applications". Your question can go WAY deeper than we have room to type here.

like image 119
TheHolyTerrah Avatar answered Jan 13 '23 05:01

TheHolyTerrah


Sounds for me like you need to log at first - maybe you can attach with PostSharp a logger to your methods (see Log4PostSharp) . This will certainly slow you down a lot and produce tons of messages. But you should be able to narrow the problematic code down ... Attach there more logs - remove others. Maybe you can stress-test this parts, later. If the suspect parts are small enough you might even do a code review there.
I know, your question was about debugging - but this could be an approach, too.

like image 38
tanascius Avatar answered Jan 13 '23 06:01

tanascius