Mysterious application crash
-
Dear all, My .Net WinForms Application quietly closes off without a warning and I am unable to understand the root cause of the problem, as it happens sporadically. I am working with .Net Framework 1.1 on Windows XP (tested on both SP 1 and 2). I tried the following: - Having a try/catch cover on all the important event handlers (OnPaint, OnMouse..., etc) and in the static Main() method (Application.Run(...)) - Set an UnhandledException handler for the present App domain. - Earlier, I was creating and releasing a COM object in a method that was being called many times. Now, I moved the creation into the class constructor and the releasing into the Dispose(). Yet, none of these options have either stopped the crash or have given me a clue. Is there a way in which I can get hold of any low level API's or tools that will be able to execute my application in a shell, which will give me a greater control on locating the cause of the crash. Any ideas will be greatly appreciated. Thanks for reading. -Rajesh.
-
Dear all, My .Net WinForms Application quietly closes off without a warning and I am unable to understand the root cause of the problem, as it happens sporadically. I am working with .Net Framework 1.1 on Windows XP (tested on both SP 1 and 2). I tried the following: - Having a try/catch cover on all the important event handlers (OnPaint, OnMouse..., etc) and in the static Main() method (Application.Run(...)) - Set an UnhandledException handler for the present App domain. - Earlier, I was creating and releasing a COM object in a method that was being called many times. Now, I moved the creation into the class constructor and the releasing into the Dispose(). Yet, none of these options have either stopped the crash or have given me a clue. Is there a way in which I can get hold of any low level API's or tools that will be able to execute my application in a shell, which will give me a greater control on locating the cause of the crash. Any ideas will be greatly appreciated. Thanks for reading. -Rajesh.
Put a try/catch inside your static void main so you can catch the error and get a stack trace. Christian Graus - Microsoft MVP - C++
-
Put a try/catch inside your static void main so you can catch the error and get a stack trace. Christian Graus - Microsoft MVP - C++
Seems to me if he was getting an unhandled exception that was causing the application to 'crash' the he would be seeing some type of exception dialog box before the app 'closes off' though. If this can be seen under some type of controlled circumstances perhaps running the app in the debugger a while might shed some light on things. At very least he might get to 'see' it happen and maybe get some debug info that way. When chasing things like this I usually start by gathering some statistics as to what the application was doing at the time it 'goes away' so I can get a better idea where to instrument things a bit. I then add some debug print statements and run the app with something like debugview running to get an idea as to what code was being executed last when the error happened.
George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Jörgen Sigvardsson wrote: If the physicists find a universal theory describing the laws of universe, I'm sure the asshole constant will be an integral part of that theory.
My Blog[^]
-
Seems to me if he was getting an unhandled exception that was causing the application to 'crash' the he would be seeing some type of exception dialog box before the app 'closes off' though. If this can be seen under some type of controlled circumstances perhaps running the app in the debugger a while might shed some light on things. At very least he might get to 'see' it happen and maybe get some debug info that way. When chasing things like this I usually start by gathering some statistics as to what the application was doing at the time it 'goes away' so I can get a better idea where to instrument things a bit. I then add some debug print statements and run the app with something like debugview running to get an idea as to what code was being executed last when the error happened.
George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Jörgen Sigvardsson wrote: If the physicists find a universal theory describing the laws of universe, I'm sure the asshole constant will be an integral part of that theory.
My Blog[^]
As i said in the beginning itself that i have a try catch block in main also, but that is of no use, when it crashes. It still crashs without informing anything... And i have tried to monitor the crashing procedure, but there is no similarity among the different occurances. I could only suspect on the Out of Memory Exception, for which i have made sure from two memory profilers that all the objects which i create, am also disposing them when they go out of scope.. I think that the problem might be at some lower level(OS level) which iam not able to get it right!! Thanks for your suggestions. Regards, Rajesh
-
Dear all, My .Net WinForms Application quietly closes off without a warning and I am unable to understand the root cause of the problem, as it happens sporadically. I am working with .Net Framework 1.1 on Windows XP (tested on both SP 1 and 2). I tried the following: - Having a try/catch cover on all the important event handlers (OnPaint, OnMouse..., etc) and in the static Main() method (Application.Run(...)) - Set an UnhandledException handler for the present App domain. - Earlier, I was creating and releasing a COM object in a method that was being called many times. Now, I moved the creation into the class constructor and the releasing into the Dispose(). Yet, none of these options have either stopped the crash or have given me a clue. Is there a way in which I can get hold of any low level API's or tools that will be able to execute my application in a shell, which will give me a greater control on locating the cause of the crash. Any ideas will be greatly appreciated. Thanks for reading. -Rajesh.
Try hooking into the System.Windows.Forms.Application.ThreadException event. Other than that I have no idea :((. Normally at least an error dialog should be displayed.
-
Dear all, My .Net WinForms Application quietly closes off without a warning and I am unable to understand the root cause of the problem, as it happens sporadically. I am working with .Net Framework 1.1 on Windows XP (tested on both SP 1 and 2). I tried the following: - Having a try/catch cover on all the important event handlers (OnPaint, OnMouse..., etc) and in the static Main() method (Application.Run(...)) - Set an UnhandledException handler for the present App domain. - Earlier, I was creating and releasing a COM object in a method that was being called many times. Now, I moved the creation into the class constructor and the releasing into the Dispose(). Yet, none of these options have either stopped the crash or have given me a clue. Is there a way in which I can get hold of any low level API's or tools that will be able to execute my application in a shell, which will give me a greater control on locating the cause of the crash. Any ideas will be greatly appreciated. Thanks for reading. -Rajesh.
RajeshGuptha wrote: - Earlier, I was creating and releasing a COM object in a method that was being called many times. Now, I moved the creation into the class constructor and the releasing into the Dispose(). If this COM object, or any other Interop call you do, call the ExitProcess() API, you'll see the behavior you described: the program closes silently, without any exception. To try isolating the problem, try to remove the COM object and any interop call, even if your program does not work, and see if still closes. If it does not close anymore, try adding each interop call you do until you find what is the culprit. I see dead pixels Yes, even I am blogging now!