Skip to content

F# compiler does not respect ExperimentalAttribute #18198

@nightroman

Description

@nightroman

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions