Code Analysis with Project Roslyn

| by Jeff Martin Follow 11 Followers on Apr 27, 2012. Estimated reading time: 1 minute |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.


Microsoft's Lang.NEXT conference held in Redmond this month included a presentation providing a demonstration of the Roslyn's project code analysis tools. Dustin Campbell's presentation, "Going Deeper with Project Roslyn", gives a soft introduction to the project and concludes with the construction of a sample project.

The Roslyn framework is not intended to be a framework for building a custom compiler, rather it is intended to focus on maximizing the utility of C# and Visual Basic. Both of these languages have had their compilers rewritten from scratch, so that Roslyn's C# compiler is written in C# and Roslyn's VB compiler is written in VB. As Campbell observes, this has allowed for numerous corner cases and bugs in the original compilers to be corrected.

Roslyn Design Characteristics

  • Immutable – Objects cannot be changed, so changes are introduced by creating new objects on the originals

  • Complete – Full representation of the source code, including whitespace, comments, errors, etc.

  • Resilient– Fault tolerance to handle errors. For example, statement completion is almost always on broken code, so parsers must able to handle it.

  • Efficient– Project is exhibits efficiency at building snapshots, and possesses the ability incrementally parse code

When the Roslyn environment is open, two instances of the active workspace exist. The first is the traditional workspace that holds the currently loaded VS solution. The other instance holds the interactive window (REPL). This separation helps statement completion and IntelliSense to work correctly on the code in development.

Campbell notes that Roslyn while available since October in Beta format, release code (version 1.0) will not be shipping with the upcoming Visual Studio 11.  Instead it will be released as part of a future VS. However, while Campbell does not specifically state this, given that the Beta supports VS2010, it would seem Microsoft could deploy it independently of a formal VS release.


Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you