3

After switching to Visual Studio 2015, we have noticed that some changes made to how lambdas are compiled to MSIL in Roslyn (described in this thread and on GitHub) introduce runtime failures under certain conditions.

Since Roslyn is obviously the future of .NET, we would like to switch to this technology, but it seems that all legacy code which has been running in production (and where we have a fair degree of confidence it works correctly) is now prone to new runtime failures. These are several libraries which are impacted by this issue also (like Moq, for example).

We already skipped the upgrade to RyuJIT for its issues, but I believe Visual Studio 2015 is heavily integrated with Roslyn and I don't think we can simply replace the csc.exe manually (but that's a different question).

So, is there a compiled list of breaking changes in Roslyn which we could reference to see what we can expect?

Community
  • 1
  • 1
vgru
  • 49,838
  • 16
  • 120
  • 201
  • This could be of some help: https://github.com/dotnet/roslyn/wiki/API-Changes – nawfal Nov 27 '15 at 11:16
  • @nawfal: this page seems to show Roslyn API changes, I am more interested in changes in generated MSIL relative to `csc.exe` from previous VS versions. – vgru Nov 27 '15 at 12:21
  • I think, you won't find these changes anywhere at the moment. You should keep an eye on [this](https://github.com/dotnet/roslyn/issues/4793) GitHub issue, which is linked to the change in lambdas. – Tamas Nov 27 '15 at 14:07
  • We're tracking this question in the roslyn repo at https://github.com/dotnet/roslyn/issues/7278 – Neal Gafter Dec 07 '15 at 18:39
  • @Neal: I found the link in [the answer below](http://stackoverflow.com/a/33960229/69809) to contain some information. Not sure if it's the "canonical" document for this, but seems to be close to it. I also thought of compiling a "todo migration list" of things to look for in my other projects that might break (like calls to `Delegate.CreateDelegate` around the code, checking for `IsStatic` or `Target` properties on lambdas, etc), but I am not sure if this list can at least get close to covering most of the issues. – vgru Dec 07 '15 at 18:53
  • @Groo That is indeed the "canonical list" yet. Unfortunately it is not complete yet. See https://github.com/dotnet/roslyn/issues/7278 . – Neal Gafter Dec 08 '15 at 22:23

1 Answers1

3

(Update)

Thanks to @NealGafter for providing the link. The list of breaking changes can currently be found here:


It seems that some documentation is supposed to be here: Roslyn Compiler Specification (roslyn/docs/compilers on GitHub). According to the description:

The compiler specification details the supported (and semi-supported) surface area of the Roslyn VB and C# compilers. This includes

  1. Command-line switches and their meaning
  2. Breaking changes from previous versions of the compilers
  3. Compiler behaviors that are (intentionally) contrary to the specification
  4. Compiler features not described by the language specification
    • COM-specific and other Microsoft-specific features
    • "Well-known" attributes that affect compiler behavior
    • The "ruleset" file syntax and semantics
  5. Features included for interoperability between C# and VB, for example
    • Named Indexers use from C#
  6. Places where the compiler behavior diverges from the language specification
  7. Limitations (e.g. identifier length)
  8. History of language changes per version

The document describing changes to CodeGen regarding lambdas (because this was my initial issue) is at roslyn/docs/compilers/CSharp/CodeGen Differences:

Non-lifting Lambda expressions are now implemented as instance methods on singleton display classes. Since the entry point to the delegate is the instance "Invoke" method, it is cheaper at runtime to dispatch delegate invocations to the underlying implementing method if such method is also an instance method with exactly same formal signature as "Invoke".

vgru
  • 49,838
  • 16
  • 120
  • 201