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
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:
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.
I have faced the same issue and the solution for me is change Solution Configuration
from Release
to Debug
. Hope it helps
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.
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/