Don’t use VS2013 Roslyn Preview

Imagine the following class diagram and what the compiler would do with the code below.
Roslyn.Difference

public class ObjectHelper {
    public static void Do(BaseObject inp, bool doit=true) {
        Trace.TraceInformation("do something base object");
    }
    public static void Do(IOther inp, bool doit=true, bool may=true){
        Trace.TraceInformation("do something other");
    }
    public static void ThisIsDifferent() {
        var o = new MyObject();
        ObjectHelper.Do(o, doit: false);
    }
}

VS2013

Compiling the source in VS2013 will succeed. Running the ObjectHelper.ThisIsDifferent() in the Immediate Window will print do something base object. So we can conclude the compiler prefers the best matching method signature. All parameters are set for the method that is executed.

VS2013 Roslyn Preview

Installing the Roslyn Preview extension in VS2013 will result in a compiler error:

The call is ambiguous between the following methods or properties: ‘ObjectHelper.DoSomething(BaseObject, bool)’ and ‘ObjectHelper.DoSomething(IOther, bool, bool)’

I’ve noticed that lots of spaces at the end of source files can throw exceptions too. Browsing to the Roslyn Github project, you’ll see that Roslyn is no longer available for Visual Studio 2013. This means no more support / updates or fixes.

VS2015 CTP6

On Azure you can get a VM with VS2015 CTP6 pre-installed. When I build my sample there no build errors and the immediate window returns the same trace statement as VS2013. Seems like the bug is fixed in Roslyn.

References

Disabling Roslyn Preview, solving a hickup in disabling the preview
Roslyn Github project

About erictummers

My work as a recruited developer changes almost every month. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s