Original source: http://blogs.microsoft.co.il/blogs/arik/archive/2010/07/12/step-into-net-framework-4-0-source-code.aspx
This article shows you how to configure Visual Studio 2010 to execute the. NET Framework 4.0 code-by-statement.
Why?
Because it's cool.
Because it helps to debug.
Not only can you see the source code, but you can execute it on a per-statement basis.
Because unlike reflector, you can get the code as well as the original comments and variable names!
First step: Download the source code
Address: http://referencesource.microsoft.com/netframework.aspx
Download the product name for. NET, version 4 for records with 175MB.
Step Two: Install the source code
Install "Net_4.msi"
I will install it to: "D:\RefSrc\"
Installing source and symbols will probably require 1GB of space (Are you more excited?)
Step three: Install Visual Studio 2010
To configure Visual Studio 2010:
1. Open Visual Studio
2. From the Tools menu, select Options.
3. In the Options dialog box, open the debug (Debugging) node and select General
-Cancel "Enable only my Code (managed only)", Enable Just I code (Managed only)
-check "Enable Source server support"
-Cancel "require the source file to match the original version exactly" "Require source files to exactly match the original version"
-Cancel "Step over properties and operators (managed only)" "stepping over properties and operators (Managed only)"
4. Select the symbol (Symbols) under Debug (Debugging)
In the Symbol File location box, add the downloaded symbol location:
"D:\RefSrc\Symbols"
Note: To add a symbolic path, click the folder icon
Enter the symbol cache directory:
"D:\RefSrc\Symbols\Cache"
Now you can press F11 (statement by sentence). NET source code.
Trouble Shooting
If you don't see the symbol, try the following:
- Verify that you are debugging your program under the. NET Framework 4.0.
- Verify that it is not installed under \program Files\, if you are already installed here, you can run Visual studion 2010 as an administrator or replace the cache directory with another writable directory.
- The runtime, right-click on the stack, has some dimmed. NET feature, select "Load symbols from" load Symbols from "symbol path" "Symbol paths".
- If you encounter "No source Available", try clicking "Browse to find source" and find the file you need in the source directory. Maybe you could use a file search to find it.
Best of all, you can find more information in http://referencesource.microsoft.com/.
Source: Read http://referencesource.microsoft.com/online #mscorlib/system/collections/arraylist.cs