none
Application has generated an exception that could not be handled

    Question

  • I am having an issue with an application on a client computer.  It works fine on the development machine and another client's machine.  It keeps throwing a Common Language Runtime Debugging Services error saying Application has generated an exception that could not be handled.  The past couple times that I have seen this for other applications, it was because a dll file didn't exist.  I checked every file that it could have been and they are all there.  Does anyone else know what could be causing an error like this?
    Monday, May 14, 2007 6:02 PM

Answers

  • Try sth. like this:

           static void Main(string[] args)
            {
                try
                {
                    AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

     ......
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An unexpected processing error did occur: {0}", ex);
                    Trace.TraceError("Unhandled exception in main thread did happen: {0}", ex);
                    Debug.Assert(false, "Unhandled exception in main thread did occur!");
                }

           static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
            {
                Trace.TraceError("Unhandled exception in another thread did happen: {0}", e.ExceptionObject);
                Debug.Assert(false, "Unhandled thread exception did occur!");
            }

    You can view the traces with the excellent Debug View from Sysinternals (now property of MS)

    http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx

    This way you should be able to diagnose the root cause of your sudden crash quite easily.

    Yours,
      Alois Kraus

    Monday, May 14, 2007 8:33 PM

All replies

  • Try sth. like this:

           static void Main(string[] args)
            {
                try
                {
                    AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

     ......
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An unexpected processing error did occur: {0}", ex);
                    Trace.TraceError("Unhandled exception in main thread did happen: {0}", ex);
                    Debug.Assert(false, "Unhandled exception in main thread did occur!");
                }

           static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
            {
                Trace.TraceError("Unhandled exception in another thread did happen: {0}", e.ExceptionObject);
                Debug.Assert(false, "Unhandled thread exception did occur!");
            }

    You can view the traces with the excellent Debug View from Sysinternals (now property of MS)

    http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx

    This way you should be able to diagnose the root cause of your sudden crash quite easily.

    Yours,
      Alois Kraus

    Monday, May 14, 2007 8:33 PM
  • Hi Michael,

    We are marking this issue as "Answered". If you have any new findings or concerns, please feel free to unmark the issue.

    Thanks!

    Thursday, May 17, 2007 7:40 AM
  • Check you have right version of .NET framework - 2.0 or 1.1
    Sunday, June 03, 2007 11:44 AM