When you use reference source functionality in vs 2008 to debug. netSource codeYou will find that many variables cannot be viewed during debugging.
This is because the sourceCodeThe Code provided on the server is optimized by default ). Although you cannot view these values, it does not block single-step execution. In most cases, you may not need to view these values.
But if you really need to check it, there is still a solution here.
You need to complain that CLR should not load the pre-jit (or ngen) image. The procedure is as follows:
First, create a CMD file. The file contains these steps to set an environment variable and then start Visual Studio. I named this file "nooptdevenv. cmd". The specific content is as follows:
Set complus_zapdisable = 1
CD/D "% ProgramFiles % \ Microsoft Visual Studio 9.0 \ common7 \ ide \"
Start devenv.exe
Exit
I put this CMD file on my desktop and use this file to start vs when I need optimizations.
Once Visual Studio is started, perform the following steps:
- Right-click your project file and choose Properties"
- Select debug and deselect enable the Visual Studio hosting process )"
- Start yourProgram.
Now you can see the values of all local and member variables:
Original article: http://blogs.msdn.com/ B /sburke/archive/2008/01/29/how-to-disable-optimizations-when-debugging-reference-source.aspx