Step Into .NET Framework 4.0 Source Code
Join the DZone community and get the full member experience.Join For Free
in this post i’ll show you how to configure your visual studio 2010 to step into the source code of .net framework 4.0
because its cool.
because it helps with debugging.
not only you can see the code but you can step into it.
because unlike with reflector , you get the code with the original comments and variable names!
step 1: download source
download from the line marked with product name: .net , version: 4
that's a 175mb download.
step 2: install source
install “net_4.msi”, which you have downloaded at the previous step.
i’ve installed it into: “d:\refsrc\”
the installed size is approximately 1gb of source and symbols (are you excited yet?)
step 3: setup visual studio 2010
for configuring visual studio 2010:
1. launch visual studio 2010
2. from the tools menu, choose options .
3. in the options dialog box, open the debugging node and select general
- uncheck "enable just my code (managed only)"
- check "enable source server support"
- uncheck "require source files to exactly match the original version"
- optional: uncheck “step over properties and operators (managed only)”
4. select symbols under debugging.
in the symbol file locations box, add the downloaded symbols location:
note: to add the symbols path click on the folder icon.
enter in text box under 'cache symbols in this directory’:
that’s it, you can now try to f11 (step into) .net source code.
if you fail to see the symbols, try one of the followings:
- make sure you debug a program under .net framework 4.0
- make sure you didn’t install it in to \program files\, since you need elevated permissions to write to there. if you already installed it there, you can either run visual studio 2010 as administrator or just change the cache folder to some other writable folder.
- while running, right click on the call stack, on some grayed .net functions, select “load symbols from” and then “symbol path”.
if you encounter the “no source available” screen, try to press “browse to
find source” and find the file you need in the source directory. you should
probably need to use files search to find it.
this is done only once, since from now on visual studio remembers this location and search there for missing source files.
finally, you can find more information at: http://referencesource.microsoft.com/
that’s it for now,
this post was first published on my blog .
Opinions expressed by DZone contributors are their own.