Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging .NET code with MS's Symbol Server - VS does not show variable's values

When I debug my ASP.NET web site code using the Microsoft debug symbol's for .NET .. I keep getting this silly 'result' for most of the variables when I'm debugging .NET framework code (which of course is provided by the Microsoft Symbol Server, which I told VS2008 to grab the info, from)

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

It's like the code I'm using is using optimized, compiled code. If that's the case, can I tell it NOT to optimize? I'm in DEBUG configuration. It's very frustrating because I cannot debug .. cause I can't see/retrieve the values of local variables as I step through the code.

Any clues/thoughts?

like image 840
Pure.Krome Avatar asked Nov 17 '08 02:11

Pure.Krome


2 Answers

Shawn Burke described a method of disabling this on his blog.

First, create a CMD that'll load Visual Studio without JIT optimization.

set COMPLUS_ZapDisable=1
cd /d "%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\ide\"
start devenv.exe
exit

Once in your Visual Studio project, do the following steps:

1) Right click on your project file and choose "Properties"

2) Choose the "Debug" tab and uncheck "Enable the Visual Studio Hosting Process"

3) Launch your application in the debugger.

like image 133
Cameron MacFarland Avatar answered Oct 21 '22 15:10

Cameron MacFarland


For a normal .Net application you can disable the use of JIT optimizations with an .INI file next to the starting binary. Here's a link to how this is accomplished

http://blogs.msdn.com/jaredpar/archive/2008/08/29/disabling-jit-optimizations-while-debugging.aspx

Debugging ASP.Net is a bit different though and I'm not sure if this will work for you. If you are debugging locally using the light weight web server (cassini) you can apply this trick to Cassini itself. If you are debuggin directly on a web server though inside of IIS I don't know how to get this trick to work but hopefully it will lead you in the right direction.

like image 38
JaredPar Avatar answered Oct 21 '22 15:10

JaredPar