A first hand look from the .NET engineering teams
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.
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:
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.
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.
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.
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.
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!
@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
its good work :)
@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...
Awesome tool. This will be very, very handy and interesting to see the code. Thanks !!!! :)