How can I diagnose my VB.NET program crash during execution?
My program keeps crashing every time I try to run it on another machine other than my own dev system. It runs just fine on mine but crashes on everybody else's when I install and run it.
To make matters worse, it only gives me the generic "[name here] has encountered a problem and needs to close. We are sorry for the inconvenience". So i never can find out why and where it is crashing!!!!
http://img513.imageshack.us/im开发者_Python百科g513/6010/ownerror.jpg
The error signature is:
EventType : clr20r3 P1 : [name here].exe P2 : 1.0.0.0 P3 : 4d5a8bcb
P4 : own P5 : 1.0.0.0 P6 : 4d5a8bcb P7 : d P8 : c6
P9 : system.invalidoperationexception
I even put the on error goto doh in the form_load and still I get nothing. Only thing it is loading up on the form_load is me.show() and thats it!
If anyone has any insight as to what I could do to figure out what its crashing on then that would be very awesome! :o)
Thanks,
David
Here are a couple of things to try/consider:
1) Have you checked the Windows application log to see if you can get a more explicit error message?
2) Try commenting out as much initialization code as possible to narrow down your problem. To me, it sounds very much like an environmental dependency, but you want to eliminate your code first.
3) What differences are there between your machine and others? Do you have libraries on your DEV machine that are required for runtime (like the VB runtime)?
Another thing.
Don't use ON ERROR GOTO ... This is an old way to track error. I don't even know if it works now. yse Try ... Catch instead.
My experience is that this is usually a problem with a missing/broken app.config file. It never gets to actually run any of your code that you can watch/track because it never finishes loading the base configuration.
What I have done in past to trouble shoot a similar problem was to install Visual Studio on a clean windows install and then install my program. This enabled me to see where in my program the error was occuring. In my case it was a missing dll file.
It could be some code in the InitializeComponent that is causing your error. On your Form.vb, add a handler for the New() event and that should show you the New() method with the initialize component call in there. Put that code in a try catch block and see if you catch any different errors.
精彩评论