Language version warning

Esben Bach's Avatar

Esben Bach

11 May, 2018 01:29 PM

So recently i noticed that PostSharp has begun to complain about the language version not being supported.

I was under the impression that postsharp was still "just" a postcompiler, so it did not have to consider syntax changes? AFAIK as long as the CLR is the same, the MSIL has to stay the same and going from C# 7.1 to 7.2 or 7.3 should not introduce new MSIL instructions. I might be wrong, but if not im curious about the warning, did postsharp start using roslyn to mutate the syntax tree or some such?

  1. Support Staff 1 Posted by PostSharp Techn... on 11 May, 2018 01:58 PM

    PostSharp Technologies's Avatar


    Good question. It is correct that PostSharp works under the hood with MSIL, and this has not changed, we aren't using Roslyn for this. However users (developers) reason at the level of abstraction of the C# language. So we continuously need to make sure that we understand the underlying C# language properly.

    A few examples:

    • in parameters require special treatment when matching method signatures (C# is stricter than MSIL)
    • ref structs cannot be copied to the heap, and PostSharp has to respect this
    • inline methods, anonymous methods, ... are not properly "understood" by PostSharp (the mapping between MSIL and C# is not obvious) and we prevent them from being the target of aspect multicasting
    • with async methods, iterators, PostSharp needs to understand the state machine quite deeply

    Previously, we supported new language features "by default", i.e. we would not do anything specific for them. But this created backward-compatibility issues when we actually started to spend time and implement proper support for them. That is, the new, correct version of PostSharp would need introduce breaking changes to fix the way the previous version incorrectly handled the old version.

    To avoid these design issues (the ones caused by backward compatibility), we decided not to support the new language versions by default, unless you force it by setting a special MSBuild property. (In this case, "we told you so", your code may break when we will support the language feature).

    That's the reason.


  2. 2 Posted by Esben Bach on 14 May, 2018 05:55 AM

    Esben Bach's Avatar

    Thanks for a thorough answer Gael.

  3. Esben Bach closed this discussion on 14 May, 2018 05:55 AM.

  4. Esben Bach re-opened this discussion on 24 May, 2018 06:59 AM

  5. 3 Posted by Esben Bach on 24 May, 2018 06:59 AM

    Esben Bach's Avatar

    Sorry for re-opening this.

    Is there anywhere on the website or in the release notes where the supported language version is noted, i am unable to find anything.

  6. Support Staff 4 Posted by PostSharp Techn... on 24 May, 2018 03:16 PM

    PostSharp Technologies's Avatar

    You can find this information in Release Notes, which are available at Each version always contains release notes of itself and all previous versions. We will consider placing this information into some better place.

    Best regards,

  7. Support Staff 5 Posted by PostSharp Techn... on 07 Jun, 2018 03:03 PM

    PostSharp Technologies's Avatar


    We are going to close this request as we believe it was solved. Please feel free to reopen the discussion if you need more help.

    Best regards,
    PostSharp Team

  8. PostSharp Technologies closed this discussion on 07 Jun, 2018 03:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac