Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away

后端 未结 17 2085
伪装坚强ぢ
伪装坚强ぢ 2020-11-29 16:12

Visual Studio 2010 kills (there is no other word) data in one of the arguments of the function in the unsafe block. What could cause this error? The following message shows

相关标签:
17条回答
  • 2020-11-29 17:07

    For web applications there is another issue which is important and it is selecting correct configuration during application publish process.

    You may build your app in debug mode, but it might happen you publish it in release mode which omptimzes code by default but IDE may mislead you since it shows debug mode while published code is in release mode. You can see details in below snapshot:

    0 讨论(0)
  • 2020-11-29 17:10

    I just ran into this and I was running under Release build configuration instead of Debug build configuration. Once I switched back to Debug my variable showed in the watch again.

    0 讨论(0)
  • 2020-11-29 17:11

    I have faced the same issue and the solution for me is change Solution Configuration from Release to Debug. Hope it helps

    0 讨论(0)
  • 2020-11-29 17:11

    Check to see if you have a Debuggable attribute in your AssemblyInfo file. If there is, remove it and rebuild your solution to see if the local variables become available.

    My debuggable attribute was set to: DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints which according to this MSDN article tells the JIT compiler to use optimizations. I removed this line from my AssemblyInfo.cs file and the local variables were available.

    0 讨论(0)
  • 2020-11-29 17:12

    As an additional answer for those experiencing this issue when debugging an Azure websites' web app:

    When deploying from GitHub, for example, the code is compiled in Azure server optimized by default.

    I tell the server to compile in a debuggable way by setting SCM_BUILD_ARGS to /p:Configuration=Debug

    but there are more options. See this: http://azure.microsoft.com/blog/2014/05/08/introduction-to-remote-debugging-on-azure-web-sites-part-3-multi-instance-environment-and-git/

    0 讨论(0)
提交回复
热议问题