Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F# compiler does not respect ExperimentalAttribute #18198

Open
nightroman opened this issue Jan 3, 2025 · 1 comment
Open

F# compiler does not respect ExperimentalAttribute #18198

nightroman opened this issue Jan 3, 2025 · 1 comment

Comments

@nightroman
Copy link
Contributor

The ExperimentalAttribute on a class in a C# library causes expected errors in C# consumer projects.
But this attribute seems to be ignored in F# consumer projects.

Repro steps

Please see the attached solution with 3 projects
2025-01-03-0427-ExperimentalAttribute.zip

  1. MyLib, the library with Class1 with ExperimentalAttribute
  2. MyAppCSharp, the C# project using Class1
  3. MyAppFSharp, the F# project using Class1

Expected behavior

Compiling both MyAppCSharp and MyAppFSharp should cause the error

MY001 'MyLib.Class1' is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

Actual behavior

MyAppFSharp compiles with no errors or warnings.
(C# project shows the error as expected)

Known workarounds

None.

Related information

  • Windows 11
  • .NET 9.0
  • Visual Studio Community 2022 (64-bit) 17.12.3
@T-Gro
Copy link
Member

T-Gro commented Jan 3, 2025

The attribute https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-12.0/experimental-attribute is a C# feature of C# 12.
The interop with existing https://fsharp.github.io/fsharp-core-docs/reference/fsharp-core-experimentalattribute.html#:~:text=This%20attribute%20is%20used%20to%20tag%20values,that%20are%20part%20of%20an%20experimental%20library%20feature. does not exist.

The attribute's fields matches the proposal from better obsoletion (https://github.com/dotnet/designs/blob/main/accepted/2020/better-obsoletion/better-obsoletion.md#api-changes ), so I think this might be packed under the existing feature request of #8654

#8654 is a open feature request looking for an implementor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

2 participants