How to get line number(s) in the StackTrace of an exception thrown in .NET to show up

后端 未结 6 1611
醉梦人生
醉梦人生 2020-12-04 21:57

MSDN says this about the StackTrace property of the Exception class:

The StackTrace property holds a stack trace, which yo

6条回答
  •  失恋的感觉
    2020-12-04 22:25

    Further to the other great suggestions, we were deploying to IIS. We had a staging server and a production server. They appeared identical except staging gave us line numbers and production did not. It turned out that there was an extra DLL in the bin directory of production (it happened to be SqlServerSpatial.dll fwiw) and once it was moved to the system directory line numbers started appearing on production.

    The lesson was to ensure that the bin directory of production matches the bin directory of development in every respect (except for XML files).

提交回复
热议问题