【问题标题】:Application has encountered a problem and needs to close应用程序遇到问题需要关闭
【发布时间】:2012-01-22 11:35:16
【问题描述】:

我需要找到应用程序在哪里运行到未处理的异常。我从以前的开发人员那里支持这一点。该应用程序正在运行,并且在它崩溃时用户没有与之交互。我已经在调试模式下运行它并且它不会崩溃。我知道它发生在解决方案中的项目,但该代码差不多有 10,000 行。任何帮助,将不胜感激。

【问题讨论】:

    标签: c#-3.0


    【解决方案1】:

    尽早添加对 AppDomain.UnhandledException 事件的订阅:

    AppDomain.CurrentDomain.UnhandledException += YourHandler
    

    里面可以记录异常信息,以后再分析

    【讨论】:

      【解决方案2】:

      你没有付出太多。你可能想查找AppDomain.UnhandledException

      System.AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
      

      【讨论】:

        【解决方案3】:

        上面的帖子中没有提供太多信息。我发现以下文章好多了: http://www.switchonthecode.com/tutorials/csharp-tutorial-dealing-with-unhandled-exceptions

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2010-12-13
          • 2011-05-30
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多