dotnet / dotnet/fsharp

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

Open
#16,362 0 comments 0 reactions 0 assignees View on GitHub
Area-Compiler-CodeGen Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Although https://github.com/fsharp/fslang-suggestions/issues/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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.