Skip to content

[Feature Request] Support C# Extension Syntax #10960

@BlankDev117

Description

@BlankDev117

Is your feature request related to a problem? Please describe.
Yes, there is an issue with being able to use the new C# extensions:

public static class MyExtension 
{
    extension (IServiceCollection services)
    {
         public Result DoSomeCoolExtensionThing() 
         {
                .....
         }
    } 
}

I've seen errors relating to the following when attempting to run run: docfx docfx.json in CI/CD style pipelines in Github Actions:
error CS1520: Method must have a return type
error CS0710: Static classes cannot have instance constructors
error CS0708: '{memberName}': cannot declare instance members in a static class

Describe the solution you'd like
The new C# language features for extensions should not bork builds

Describe alternatives you've considered
Using standard extension with the older language features. This will work, but it's not staying modern.

Additional context
N/A

Note: If this is user error or something else I'm unaware of, let me know. Happy to close the issue due to ignorance on my part.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions