How to cancel optimizations (code optimization) when debugging. Net source code using reference source-translation

Source: Internet
Author: User

When using the PDB to debug XAF, it is found that many variables are not visible. All are optimized.

The following methods can be resolved.

When you debug. Net source code using reference source functionality in VS 2008, you will find that many variables cannot be viewed while debugging.

This is because the code provided on the source-code server is optimized for final sales by default (optimized). These values, although you cannot view them, do not block stepping, and in most cases you may not need to see them.

But if you really need to see it, there's still a way to do it.

You need to sue the CLR not to load Pre-jit (also add NGen) mirroring. Here are the specific steps:

First, create a cmd file. The file contains a few steps, set an environment variable, and then start Visual Studio. I name 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 to disable optimization (optimizations).

Once Visual Studio starts, the following steps are required:

    1. Right-click your project file and select Properties
    2. Select Debug (Debug), uncheck "Allow Visual Studio managed processes (enable the Visual Studio Hosting process)"
    3. Start your program in debug mode.

Now you can see the values of all the local and member variables:

Original: Http://blogs.msdn.com/b/sburke/archive/2008/01/29/how-to-disable-optimizations-when-debugging-reference-source.aspx

How to cancel optimizations (code optimization) when debugging. Net source code using reference source-translation

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.