Thursday, May 5, 2011

.Net Application Exits Abruptly

My .Net appliaction exits abruptly on certain machines ( this is a desktop application). I tried to catch the exception but the catch statement I put on simply can't catch the exception that was happening.

Any ideas how to solve, or diagnose this problem?

Note: This exception only occurs at client's machine, release mode, on which we have no debugger tool to use.

Note 2: The application event log does not contain any errors at all.

From stackoverflow
  • You may want to try adding an event handler to System.Windows.Forms.Application.ThreadException and System.AppDomain.CurrentDomain.UnhandledException to see if you can figure out what exception (if any) is causing your application to terminate.

  • In the debug drop down menu in Visual Studio choose exceptions and check all the checkboxes under thrown. This should halt the app at any unhandled exceptions. Examine it and give us the results.

    Ngu Soon Hui : Not sure this is applicable. Because it only occurs on release mode, in client's machine. We can't reproduce it here, though
  • Can you check the Application Event Logs on the client's pc incase the .NET runtime is logging something?

    Ngu Soon Hui : I checked the event logs.. unfortunately no error was recorded.
  • This is almost always caused by a COM/PInvoke issue where the native code you've used raises a Win32 exception. Under certain circumstances Windows will elect to simply abort the process rather than tear it down normally when their is major state corruption such as an invalid stack pointer.

    If you can determine what specific behaviors precede the shutdown you can narrow your search for the controls/PInvokes that might be causing the problem.

    Austin : If your application is PInvoke-ing, is compiled as AnyCPU, and your development machines are running 32-bit windows, you can experience crashes when you run your application on 64-bit Windows. A simple fix for this is to compile your application as x86. Scott Hanselman posted about this: http://www.hanselman.com/blog/BackToBasics32bitAnd64bitConfusionAroundX86AndX64AndTheNETFrameworkAndCLR.aspx

0 comments:

Post a Comment