且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Visual Studio 2015:我无法在发布模式下调试和使用断点

更新时间:2023-01-02 21:29:19

调试优化代码始终是一项挑战-甚至更多.NETNative。您可以尝试以下操作:

Debugging optimized code is always a challenge - even more so with .NETNative. Here are a few things you could try:


  • 禁用仅我的代码

  • 禁止JIT优化: 这对于使用.NETNative工具链构建的模块没有帮助。如果在没有.NETNative的发布版本中发生异常,请检查调试器选项 在模块加载时禁止JIT优化(仅受管)。顾名思义,这将导致未优化CLR至JIT的编译代码,这将使您可以设置断点并检查本地变量。

  • 查看输出窗口,以了解出现问题的线索。 。将会出现异常消息,并且前面的消息可能有助于诊断原因。

  • 使用本机调试引擎调试应用程序。您可以通过在项目属性的调试选项卡下选中本机复选框来完成此操作。

  • 最后的方法是调试程序集。

  • Disable Just My Code
  • Suppress JIT Optimizations: This will not help for modules built with .NETNative toolchain. If the exception occurs in Release builds without .NETNative, then check the debugger option called "Suppress JIT optimization on module load (Managed Only)". As the name implies, this will cause the CLR to JIT compile code unoptimized, which will allow you to set breakpoints and inspect locals.
  • Look at the Output window for clues as to what went wrong. The exception message will be there and the preceding messages may help diagnose the cause.
  • Debug your application with Native debug engine. You can do this by checking the Native checkbox under the Debug tab of the project properties.
  • Last resort is to debug the assembly.