News

.NET Framework Reference Source Updated Via 'Roslyn'

Developers can search for incompatibilities between their own code and .NET more easily than ever.

Have you ever upgraded to a newer version of Microsoft's .NET Framework, and suddenly found that one of your applications started acting buggy, or quit working altogether? It was very likely due to changes made in the .NET source code, and forced developers to spend long hours combing through code -- both their own and Microsoft's, in many cases -- to spot the changes.

Microsoft is working to change that. It has long had its .NET source code open to the public -- since 2007, reports Principal Program Manager Scott Hanselman on his blog -- but its value was limited because of infrequent updates. Officially called the ".NET Reference Source," it's being replaced by a newer version using the "Roslyn" compiler-as-a-service technology. Using Roslyn, Hanselman writes, generates "...a complete syntactic and semantic index of the .NET Framework Sources." The upshot is that every time the .NET Framework is updated, the .NET Reference Source will be updated as well.

Not only will the .NET source code be updated as often as .NET itself, but other updates will make it integrate better with Visual Studio. Alok Shriram, Program Manager on the .NET Framework team, wrote that well-known developer Schabse S. Laks has written a Visual Studio plug-in called "Ref12" that enables access to the .NET Framework Source by pressing F12 within the IDE (note that this is currently available only for C#; Visual Basic isn't supported, although Laks indicated a willingness to make it available, if it's requested.)

For those not working in Visual Studio, the .NET Framework Source can still be searched within a Web browser with a tool that gives "Go to Definition" and "Find All References"-like functionality. The .NET Framework Source is also available as a zip file, so developers wanting to work offline can still use it (it can be opened in Visual Studio).

Shriram explained how the new process will work:

"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 (Program Databases) are also updated to the reference source site appropriately. The summary of this is going forward the reference source debugging experience should just work."

The new .NET Framework Source site is still in beta; Hanselman blogged that it will "soon" replace the existing Source site.  

Roslyn is the project to fully rewrite the Visual Basic and C# compilers and language services (i.e. the language editing experiences) in their own respective managed code language; Visual Basic was rewritten in Visual Basic, and C# was rewritten in C#. It was officially enabled last December, according to Matt Gertz, the Visual Studio Managed Languages Development Manager. He wrote that the daily builds of Visual Studio are now compiled using Roslyn.

Roslyn exposes information regarding source code parsing (what elements are present in code), semantic analysis (what they mean), binding (how they relate to each other), and IL emitting (executable code).

About the Author

Keith Ward is the editor in chief of Virtualization & Cloud Review. Follow him on Twitter @VirtReviewKeith.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube