本文介绍了应用程序已在C#.NET应用程序中停止工作错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我收到的是"应用已停止工作"我的C#WinForms应用程序中的错误。运行的操作系统版本是Windows 7 Home Premium,W​​indows 7 Professional以及一些WinXP Home机器。我的代码中设置了异常处理程序:

I am receiving an "Application has stopped working" error in my C# WinForms application. The running OS versions are Windows 7 Home Premium, Windows 7 Professional and also a few WinXP Home machines. I have an exception handler set up in my code:

  public void MyExceptionHandler

             (对象发件人,ThreadExceptionEventArgs e)

        {

        

            MessageBox.Show(QUOT;内部错误" +

              " \ r \\\ n                e.Exception.Message +" \\\\\ nn" +

                "堆栈跟踪:" + e.Exception.StackTrace,"Oslermedicine®管理器通知");

    &NBSP ;   }
       

 public void MyExceptionHandler
            (Object sender, ThreadExceptionEventArgs e)
        {
        
            MessageBox.Show("Internal Error" +
               "\r\n\r\n" +
                e.Exception.Message + "\r\n\r\n" +
                "Stack Trace: " + e.Exception.StackTrace, "Oslermedicine® Manager Notification");
        }
       

此代码由于某种原因从未被调用,Windows会处理任何错误。

This code is never called for some reason and Windows handles any errors.

我在主表单的_load事件中设置了ThreadException:

I set up the ThreadException in my _load event for the main form:

Application.ThreadException + = MyExceptionHandler;

Application.ThreadException += MyExceptionHandler;

什么会导致这种行为?

谢谢

Mike

推荐答案

http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx

http://msdn.microsoft.com/en-us/library/system.windows.forms.application.threadexception.aspx


这篇关于应用程序已在C#.NET应用程序中停止工作错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 01:54