Unhandled Exception in Winforms Application

后端 未结 2 1752
不知归路
不知归路 2020-12-10 06:29

I have a simple WinForms app that is used to enter test cases. Ever since I upgraded this application to .NET 4.0 and added a new tab page to the tab page control for valida

相关标签:
2条回答
  • 2020-12-10 07:16

    If you're using Visual Studio, you can set it to break on all unhandled exceptions and even any time that an exception is thrown, regardless of whether or not it is handled by your code.

    To do this, select "Exceptions" from the "Debug" menu. You'll get a dialog box that looks like this:

      Visual Studio Exceptions dialog

    If you really want to get serious, try checking all of the boxes. Then, find out from your QA guy what exactly is being done to trigger the exception, and reproduce those actions exactly while running under the debugger within the development environment. Whenever the exception is thrown, Visual Studio will break and you'll see the offending line of code along with a complete stack trace.

    0 讨论(0)
  • 2020-12-10 07:26

    Try adding the following to your app.config

    <runtime>
       <!-- the following setting prevents the host from closing when an unhandled exception is thrown -->
       <legacyUnhandledExceptionPolicy enabled="1" />
    </runtime>
    
    0 讨论(0)
提交回复
热议问题