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

Subscribe on YouTube