How to cancel optimizations (code optimization) when using reference source to debug. net source code

Source: Internet
Author: User

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:

    1. Right-click your project file and choose Properties"
    2. Select debug and deselect enable the Visual Studio hosting process )"
    3. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.