Roslyn CTP 3 released -- breaking changes

Posted by Filip Ekberg on 17 Sep 2012

Microsoft has released yet another CTP version of Roslyn and this doesn't come as a big surprise. Since the previous CTP (CTP2) does not work very well with Visul Studio 2012. Now with Roslyn CTP3, we have Visual Studio 2012 support! However, this upgrade does come with a price, there are some breaking changes in the third version of the Roslyn CTP.

You can download the latest Roslyn CTP3 here.

This unfortunately breaks some code samples in my book C# Smorgasbord, but not to worry. The changes are pretty easy to figure out and I've put together an Errata that covers all the code samples that are affected by the breaking changes.

You can find the Errata here.

If you're using Visual Studio and you have intellisense enabled, it's going to be pretty easy to figure out what has changed. Below is a short list of what I've found and what is in the Errata.

No longer possible to run Scripts through ScriptEngine directly

To execute a snippet you need to create a session first, like this:

var engine = new ScriptEngine();
var session = engine.CreateSession();
var result = session.Execute("var x = 10; x");


ParseCompilationUnit is removed

You can now use ParseText and ParseFile instead.

The auto generated GetIssue method has changes.

When creating a Code Issue project, the generated file is changed a bit. Instead of GetText() on the token, you now use ToString() and instead of CodeIssue.Severity.Warning you use CodeIssueKind.Warning.

Method AnalyzeStatementDataFlow is renamed

The method AnalyzeStatementDataFlow on SemanticModel has been renamed to AnalyzeDataFlow().

There are probably a lot more changes to Roslyn than the ones listed above.

If you have any questions regarding the code samples in C# Smorgasbord or if you want to chat about Roslyn, leave me a comment or an e-mail. Even though these are breaking changes, it does not ruin the reading expreience of C# Smorgasbord!

comments powered by Disqus