Skip to content

F# style extension methods with [<Extension>] attribute applied generate C# incompatible method names #16362

Open

Description

@xperiandri

Although fsharp/fslang-suggestions#835 is implemented the names of methods that are generated are incompatible with C# hence not shown in autocomplete.

Repro steps

https://sharplab.io/#v2:DYLgZgzgNAJiDUAfA9gBwKYDsAEBlAnhAC7oC2AdAEoCumRAlqeuQMLKmr3DoBOuvAN3oBjdBACwAKCkBtADwBRAB4lMEeskwA+ALpTSyGNW7YA6ugBGAQQgQyF4PgASyYstXrNEbAF4pU7EDsNCw8QhJSAKCQnAJiMip0MG5hBk0owJiw+IoAFXQVcgApCHTpSSDsInwMbGVRVDScAHd6IgALfwrKoPl3LE9tPW6e7CZSC15sAsSeAEN6OwAKAEpfbFWMnq3KvpUBjUwAbmw2Di50GAA5OaZsACIAMXolS/vdHaDxyZ5ppVmFnZnq8YKt1psRqMglIgA===

As you can see method name Exception.Reraise is not compatible with C# because of dot.

Expected behavior

Either generate a compatible method name
Or produce a warning that asks to rename method using CompiledName attribute or suppress it

Actual behavior

Neither compatible name, nor warning.

Known workarounds

Apply CompiledName attribute

Related information

.NET Core 8.0.100

Activity

  1. added this to the Backlog milestone on Nov 30, 2023
  2. added
    Impact-Low
    Area-Compiler-CodeGen
    and removed on Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CodeGenBugImpact-Low

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions