Skip to content

Handle C# 14 extension members #30

Open

Description

@bjornhellander

See https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-14#extension-members

Investigate needed changes (including just adding tests for cases that already work as expected).

Activity

  1. bjornhellander commented on Sep 15, 2025

    @bjornhellander
    OwnerAuthor

    Incorrect behavior:

    • SA1101 false positive in instance members
    • SA1137 false negative at inconsistent indentation inside extension block
    • SA1502 false negative for extension block with openning and closing braces on same line
    • SA1505 false negative at starting blank line first in extension block
    • SA1508 false negative at ending blank line in extension block

    Add tests for already correct behavior:

    • SA1000: Keyword extension should be ignored
    • SA1008: There should be no space in extension<TSource> (
    • SA1008: There should be no space in extension<TSource>( IEnumerable<TSource>)
    • SA1009: There should be no space in extension<TSource>(IEnumerable<TSource> source )
    • SA1014: There should be no space in extension <TSource>
    • SA1014: There should be no space in extension< TSource>
    • SA1015: There should be no space in extension<TSource> (
    • SA1201
    • SA1202
    • SA1203?
    • SA1204?
    • SA1313: Parameter name should start with lower case
    • SA1314: Type parameter should start with T in extension block
    • SA1400: No access modifiers is not needed for extension block
    • SA1507: Multiple blank lines should not be allowed inside an extension block
    • SA1509: There should be no blank line before the opening brace in an extension blolck
    • SA1513: There should be a blank line after an extension block
    • SA1515: Should not trigger first in extension block
    • SA1516: There should be a blank line after an extension block

    Investigation is in progress.

    How to treat this in documentation rules? Not require documentation, but make all other rules run if it exists?
    What about SA1201ElementsMustAppearInTheCorrectOrder?
    What about SA1600ElementsMustBeDocumented?
    What about SA1611ElementParametersMustBeDocumented?
    What about SA1618GenericTypeParametersMustBeDocumented?
    What about SA1619GenericTypeParametersMustBeDocumentedPartialClass?

    Check SA1400 again!

  2. bjornhellander commented on Sep 18, 2025

    @bjornhellander
    OwnerAuthor

    Handled analyzers with incorrect behavior in #44

  3. 16 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions