Language version warning

Esben Bach's Avatar

Esben Bach

11 May, 2018 01:29 PM

Hi
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

    Hello,

    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.

    -gael

  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 https://www.postsharp.net/downloads. Each version always contains release notes of itself and all previous versions. We will consider placing this information into some better place.

    Best regards,
    -tony

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? 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