Unhandled Exceptions with Global.asax

前端 未结 2 1881
时光取名叫无心
时光取名叫无心 2020-12-31 10:32

I am emailing unhandled exception details from global.asax. How can I get the path and/or filename of the aspx file or assembly file where an exception was not handled.

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-31 11:35

    In Visual Studio, you need to set the release build to generate debugging symbols. Unlike in the debug build, this isn't set by default. This will give you the full exception stack trace.

    Even then, optimisations done by the JIT compiler (such as inlining) may mean that you don't get the right line number in your stack trace. If you want to be sure about the line number, you can also set the release build to "no optimisation". But this may mean that your app has lower performance and/or throughput (the latter tends tobe more important in a web app).

    EDIT: You can find the "generate debugging symbols" setting by going to the Solution Explorer window, right-clicking on the project, and choosing the "Properties" menu item. Then go to Configuration Properties > Build > Generate Debugging Information and set to true or false. The Optimize Code setting is in the same window.

提交回复
热议问题