This post was written by Alok Shriram, Program Manager on the .NET Framework team. He will show you a significantly improved experience around .NET Reference Source.
Today I’m very excited to announce that we have an awesome new experience to use the .NET Framework reference source.
Browsing .NET Reference Source
First of all, most people just want to look at code. So we’ve added a brand new source browsing experience. For a tutorial, checkout our Channel 9 video:
This new browsing experience provides the following features:
- Go to Definition and Finding References. You can now browse through .NET framework code in a Visual Studio like experience with features analogous to “Go to Definition” and “Find All References”. This tool was developed for internal use but we found it to be so incredibly useful that we had to share it with you. The video above highlights some of the cool features of this site and how you can use it. For more details, checkout the help page.
- Offline Browsing. You can download the entire reference source as a zip file, which now also includes project and solution files, so that you can easily open and browse it in VS.
- Jump to Reference Source right from Visual Studio. Schabse Laks has written an extension to VS called Ref12. This extension changes the behavior of F12 to jump to the online browser for symbols that aren’t in your solution but are part of the .NET Reference Source. If you have any more interesting ideas around how you can use leverage this site please touch base with us by using the feedback button on the site or leave a comment here in the post.
We generated this site using Project Roslyn, our new C# and VB compilers.
Using .NET Reference Source for debugging
We are also happy to announce that you can now step through .NET framework sources for .NET framework 4.5.1 and any associated patches and updates.
This has been one of the highest voted items on User Voice:
We are pleased to close this item as resolved. To read about how to setup VS to take advantage of this feature please go here.
So what does it mean for your day-to-day activities? Let’s assume that you have an app that uses List<string> to display a set of controls. One day after a framework update you suddenly realize that the order of the controls in your app has suddenly changed. You fire up VS and follow the instructions described above and start stepping through you code like you normally would. You get to the point where you were doing your sorting:
Hit F11 and voila you are in the List<T>.Sort code! Sweet.
We find that this is an extremely useful diagnostic tool for our developers when they are investigating issues internally. So we decided to fix this experience so that it also “just works” for you. This will give you the ability to better understand and diagnose issues between our and your code.
Improvements when debugging .NET Reference Source
Historically since the inception of this effort, we have published sources and PDBs for every major .NET framework update namely .NET framework 4.0 and 4.5. However these builds would be rendered effectively useless the moment any update to the framework was released, since the binaries on the updated box no longer matched the PDBs that were indexed on the reference source server. Unfortunately the design of the system that we had in place was geared towards doing single and infrequent pushes of sources and symbols out and did not account for the sheer volume of builds and patches that come are produced out of the .NET framework build system.
Starting with .NET 4.5.1 we have radically changed the symbol indexing and publishing process to be in sync with the build process such that as and when updates are shipped , the corresponding PDBs are also updated to the reference source site appropriately. The summary of this is going forward the reference source debugging experience should just work. If it does not use the troubleshooting instructions at the link provided above and send us an email with the data requested, we will do our best to turn it around quickly.
There is one caveat to this experiences; for security updates or updates that are otherwise deemed to have changes that we do not want leaked (think security exploits) you will still have a debugging experience, but rather than the file that corresponds to that PDB, you will get the last broadly shipped copy of that file. This could manifest itself in a slightly skewed debugging experience if you are stepping through a file where the fix was made.
How does reference source relate to the Microsoft Symbol Server?
The Microsoft Symbol Server is a repository where all public PDBs generated by most teams at Microsoft end up. However all PDBs that are present here do not have any source information in them, which makes them not very useful for stepping through sources. When you are trying to debug .NET Framework source please ensure that you do not have the Microsoft Symbol Server enabled. Doing so could result in the symbols being loaded from the Microsoft Symbol Server and the source stepping experience would not work in that case. You can disable Microsoft Symbol Server lookup via Tools | Options | Debugging | Symbols. Ensure that the checkbox in front of Microsoft Symbol Server is unchecked.
What’s next?
But wait! There is more:
-
Replacing referencesource.microsoft.com. Our most immediate goal is to retire the current page at http://referencesource.microsoft.com in favor of the new browsing experience. Please take a look at the old site and let us know of any concerns you have around deprecating it.
-
Updating the indexed sources. The version of the framework that we currently have indexed is .NET Framework 4.5.1. Due to the improvements we made in our engineering system, we’re now able to update both the symbols and the sources as new versions of the framework are released.
-
Adding source for assemblies. As you can probably notice, the set of assemblies that we have is not complete. We don’t intend to keep it that way, so we plan to expand the set of assemblies over time.
Summary
Today we announced a new browsing experience for the .NET Reference Source. We’ve also fixed the long standing issue with using reference source for debugging.
We would love to hear your feedback. Please let us know what you think about the new browsing experience by leaving a comment on this blog or by emailing us. Also, if you’re missing specific assemblies, please let us know so that we can prioritize which ones we add first.
Happy browsing & debugging!




Wahoo, finally!
Thanks!!! Good work!!!
Holy ***! <3 This is amazing =D thank you sooooooooo much! AWESOME 🙂
Excellent!
Amazing.
Wow… this is great news
Incredibly awesome. I do hope we will get a new refresh of Roslyn at the BUILD conference since you're in the dogfooding stage internally.
Pretty awesome.
It would be even better if you opensourced the browser.
It could be used for NuGet gallery, for example (for packages that have sources of course).
Any chance you guys could add links in the MSDN documentation to the applicable source code? So if I'm on msdn.microsoft.com/…/system.environment(v=vs.110).aspx then there would be a link to where System.Environment is defined at referencesource-beta.microsoft.com. I think that would be very helpful if something in the documentation is not making sense then I can easily view the full definition of the class/method/property/etc with a single click.
Thanks. I was wondering how you manage the source code documentation at microsoft because some classes use "///" comments to provide doc and some don't. How do you get a consistant MSDN doc out of this?
Bing code source plus reference source, my headaches are gone, amazing 🙂
lionel: It's complicated. 🙂
We actually generate XML docs from MSDN docs, not the reverse. While /// XML docs in the code help feed into the MSDN docs, they aren't the final product.
David Kean
.NET Framework team
@Bart Sipes Thanks Bart. This is something we are considering. Stay tuned.
Great news. You should add to VS functionality of Ref12, to open source within VS, not in browser. Also, make it open for anyone who create library and want to show source code for others.
Pretty good!
@Tristan This is certainly on our radar. But to set expectations: we're trying to exercise the agile principles, which effectively boil down to crawl, walk, run. So before we open this tool to all the great libraries of the world*, we'll probably start with pulling in more and more hand selected libraries. That doesn't mean that's limited to only Microsoft code, but we'd like to ensure that our infrastructure (and approach) scales first.
*No, this is not a commitment that we'll actually end up doing it 🙂
.NET Framework stepping still not working for me. But the good news is that I wasn't expecting it to work!
(I'm on 2013, new console project on 4.5.1, and I followed the instructions at referencesource-beta.microsoft.com/setup.html and tried your Sort() example.)
Pretty good. Unfortunately, It does not solve my problem with older framework 4.0, because You support only 4.5.1 framework. 🙁
Congratulations on the work. This is really nice!
Can this be extended to cover NuGet package sources as well, where available? Or any plans to do so?
@david: thanks, I was sure these "///" XML comments were not used!
I was also wondering how you ensure code quality?
I see in many places that the coding conventions are not respected. Do you have peer code reviews in microsoft to ensure the developers don't go out of the lines?
Is there a way to build the downloaded reference source?
Hi. Did you test this on slow internet connections? I followed the instructions at referencesource-beta.microsoft.com/setup.html , now Visual Studio has been 'downloading public symbols' for at least five minutes. Meanwhile I can't do anything else—can't run my app, can't edit code.
Great video. Thanks for sharing!! Good work
Regards,
Jalpesh
http://www.dotnetjalps.com
its good work 🙂
thanks
http://www.eltm.ir
@adigostin could you please send us the info requested the troubleshooting steps on the same page and we can look into it.
@HGM any sense of what your connection speed is. The symbol download should be a one time thing for a given build, since they are cached after the first load. Do you see this issue on subsequent loads?
@Ilias No you cannot build the downloaded source, since you do not have things like resource files.
Good work. Does this include .Net for WP8 (at first glance looks like it doesn't)? If not, could it? As it is a major hassle extracting .dlls from emulator and using Reflector to examine…
Thanks
Awesome tool. This will be very, very handy and interesting to see the code. Thanks !!!! 🙂
LMK: No this does not include the exact source that shipped in WP8. However, WP8 and .NET Framework build from the same sources, so while you cannot step into WP8, you can browse the source and have a fairly good indication of what shipped in WP8.
David Kean
Guys please consider implementing single instruction multiple data (SIMD) support in C#.NET.
Its being a LONG time, mono is teasing .NET.
Will it ever happen? Clues !?!?
I do not see exactly how this is related to Roslyn, could you say more about that? Thanks!
@Jackie boy: Usual disclaimer that I can't commit on anything but we are taking a serious look at SIMD.
@Pierre: Sure. Our awesome friend and MVP Schabse Laks has written a great blog post about how Roslyn powers .NET Reference Source. blog.slaks.net/…/dissecting-the-new-net-reference-source-browser
Thanks! that's good!!
I wasn't a big fan of the current reference source.
Firstly, the names of the files on referencesource.microsoft.com that you could download were non-sensical. You couldn't easily tell which .NET version each file was for.
Secondly, the actual code was a mess:
A) Files had inconsistent formatting among them.
B) Code formatting was awful. Some lines had spaces at the end, other times there were unnecessary imports and other times multiple unnecessary blank lines, while the comments were full of spelling mistakes, wrong punctuation and were not really clear. Lines were too long and methods were randomly scattered around the file. It seemed that Microsoft had no consistent formatting rules that all developers were forced to follow.
C) The actual code was awful. Wrongly designed class hierarchies and poorly written code that did not seem to care about error conditions, especially for WPF. Compared to other projects for which I have seen the code it was really bad. For example, Google's Closure library is very well written, with excellent comments and algorithm implementations which seem to be robust against all conditions.
D) There were no unit tests and the code did not appear to have been written with testability in mind, so I doubt that the unit tests were simply omitted.
I seriously hope that you have improved all the above shortcomings.
Plus, I forgot to say that, each file had the same code written twice in it and the folder structure was non-sensical.
Audio on the video would have been fantastic … just saying
Really nice tool, I've already used it several times. It took me a while to realize I can click on almost anything… great.
Is it possible to add the version to the URL? I'm a little worried when I use a link like /#mscorlib/system/gc.cs#17 , because one day the file will be updated, and the line numbers will change (or the file will be renamed)…
Is there anyone outside Microsoft who has got it to work yet?
Just like adigostin wrote, it does not work for me either. I tried a minimal List<> example, using VS 2013 Professional and .NET 4.5.1.
I wonder if it is really enough to unselect "Microsoft Source Server" and not adding any replacement URL or path?
And please add System.Windows.Forms.DataVisualization.dll
Thanks!!
@Nick I hope you have found the new experience to be a more pleasant one. With regards to things like code quality, please let us know in case things are busted or broken using the feedback links on the site and we will definitely take a look. We are already aware of some files having some artifacts due to a bug in our sanitization process.
@Jon Preece We got that feedback 🙂 sorry for the silent movie. Will work on updating the video with a music track at least.
@Bernhard please send us the information that we requested on the troubleshooting site. We realized in our attempt to reindex all the builds, one build got missed the file version on the DLL is 30319.34004. We are going to add that in soon. and noted w.r.t System.Windows.Forms.DataVisualization.dll
I have been wanting this for a very long time.
Are you excluding the security patches just in case the black hats haven't discovered Reflector yet?
That's a joke, right?
I got it to work within VS 2013 with a little help from Alok. The key step that I was missing was to clear the symbol cache from previously loaded PDBs without source references, using Tools|Options|Debugging|Symbols|Empty Symbol Cache.
Many thanks, this is very useful.
Are there any plans to make reference source for the native code parts of .NET available?
For me, insight into the implementation of the framework hosting interfaces in mscoree.dll would be extremely valuable.
Are there any plans to make reference source for the native code parts of .NET available?
For me, insight into the implementation of the framework hosting interfaces in mscoree.dll would be extremely valuable.
I agree with @Govert, we do have the 2.0 CLR source (Govert if you did not know about it Google "Shared Source Common Language Infrastructure 2.0 Release ") but it would be nice to have the same thing for CLR 4.
Thanks so much for this.
As a suggestion it would be extremely useful to have some sort of tool that would tell whether a local DLL has a related PDB on the source server. So extract the GUID for the PDB GUID from the DLL and simply state whether there is a matching one on the source server.
Ideally what I would really like is to be able to point to an EXE or DLL and find out which of the .NET DLL's it depends on have matching PDBs and are hence debuggable.
Maybe this already exists but I haven't been able to find it on my searches.
One issue I encountered when I want to point someone else to a specific line of code in Reference Source. It seems that I cannot add a hyperlink with line number in Outlook or Word.
After I edit the hyper link, say, referencesource.microsoft.com, if I edit it again, the last anchor is removed automatically and it becomes referencesource.microsoft.com.
@Govert @Scott as of right now we were not planning on releasing the native parts of .NET. Since this seems to be of interest to folks, we can start a conversation about this on the team.
ZhiliaXu:
Try removing the first hash and appending .html after .cs:
referencesource.microsoft.com/…/SqlInternalConnectionTds.cs.html
This is awesome news. Now… add in the XAML files and things will get even better. 🙂
The link old site in "What's Next" and " new browsing experience for the .NET Reference Source" in Summary point to same site. I think the old site was "referencesource.microsoft.com/symbols".
Am i missing something here?
awesome, Great Work!!! very nice
I am getting a 404 error on every symbol the debugger tries to download.
Is this because I have taken all the security patches
@cj could you touch base with us with the information we have requested in the trouble shooting section on the site refsource.redmond.corp.microsoft.com/setup.html.
Hi,
I'm still a bit confused. In a previous post (blogs.msdn.com/…/announcing-the-release-of-net-framework-4-5-rtm-product-and-source-code.aspx) it is mentioned that I need to add a new symbol server (referencesource.microsoft.com/symbols).
Is this still required for your new source debugging implementation for .NET 4.5.1 and VS2013? Or is it sufficient to leave "Microsoft Symbol Servers" checked?
Additionally, if I am targeting .NET 4.5 while 4.5.1 is installed – do I need to add referencesource.microsoft.com/symbols as a symbol server or should I leave "Microsoft Symbol Servers" checked?
Could you please clarify this on referencesource.microsoft.com/setup.html
Thanks,
matt
where is the .net 4.0 source code package?
Please, please add the WPF default themes to reference sources
(especially since they are not accessible anymore via go.microsoft.com/fwlink or code.msdn.microsoft.com/…/FileDownload.aspx)
Aside from this, thanks so much for this service!
1 When can we expect to see the 4.5.2 references?
2 I am still not able to debug into sources. I unsuccessfully tried all descriptions/hints with Win 8.1 / VS 2013 Pro / dotnet 4.5.1 installed and target / and now 4.5.2 installed and target. Never could step into list.Sort() or any other sources (except the URI Class – only in 4.5.1 !?) Pls. provide more troubleshouting with the VS settings / Server configs.
Hi Alok,
any news about wheter/when you will include DataVisualization.dll?
Thanks!
Bernhard
Wow! Massive effort.
This is awesome
Has anyone gotten this to work recently in VS2013? I've been trying to step into System.Configuration and have wasted hours trying to get this to work…
I just found an option in Reflector Pro to generate a PDB from decompiled sources. I selected System.Configuration and it worked! Thank you Reflector!
Has anyone got Reference Source debugging to work? I can't get any source code to show up. The symbols are loaded but when I try and step into the .NET methods I get the Source Not Available page. I've fiddle around with the symbol paths, downloaded the DotNetReferenceSource.zip, tried adding folders from that extracted Zip to my solutions's Debug Source Files property page, but still no luck…. driving me crazy!
Nice, although keeps crashing on System.Runtime.Serialization.Formatters.Soap
Help with System.Web.dll ? I can't seem to get this to show source, even trying a vanilla install on a blank vm of vs 2013 update 4. All I get is this:
SYMSRV: referencesource.microsoft.com/…/System.Web.pdb not found
referencesource.microsoft.com/symbols: Symbols not found on symbol server.
SYMSRV: System.Web.pdb from msdl.microsoft.com/…/symbols: 131401 bytes
msdl.microsoft.com/…/symbols: Symbols downloaded from symbol server.
C:SymbolsSystem.Web.pdbE6EBD6B61CEA407591438CC4E48036891System.Web.pdb: Symbols loaded.
But no source.
See others:
stackoverflow.com/…/why-cant-i-find-system-web-pdb-on-referencesource-microsoft-com
stackoverflow.com/…/debugging-net-4-5-1-system-web-dll-source-with-visual-studio-2013
Can't get it to work…
@Brandon could you reach out to us using the email on the site so that we can help diagnose/debug your issue.
If you could provide the build number for the System.Web.dll it would be great.
WTF windows workflow debugging doesn't work?
Amazing <3 <3 <3 <3
well done!!
"long standing" is one word: longstanding.
cool~~
I try since a few days to debug the system.data dll. But nothing works as suggested. I am using Visual Studio 2015 with .Net framework 4.6, but I suppose this is not the problem. Clicking at run time on “go to definition – native” always shows only the meta data. Stepping with F11 causes the debugger to jump over the method. Even the local downloaded sources will be not shown and used at debug time. Sure I can view the implementation of the dll but this ist not the point.
I controlled all instructions shown on the page https://referencesource.microsoft.com/setup.html, but this does not changes something on my problem.
And at last I am not able to email the header dump of the dll because due to the restriction on the email group.
Is there anything more what I can do get the debugger to jump in the system.data dll? Thanks a lot. Frogorek
A small error are crept into my article. Browsing the source works by as described by pressing of F12 or clicking on ‘go to definition’.
thanks
I have a similar problem to Fred Rogorek.
I was unable to email the address you provided, and I was also unable to run the command:
dumpbin /headers (dll-Name)
in either Developer Command Prompt or PowerShell.
Which, of course, I was trying to do because even after enabling Symbol servers it still jumps straight over the .NET code.