Skip to content

F# compiler does not respect ExperimentalAttribute #18198

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

Activity

  1. added this to the Backlog milestone on Jan 3, 2025
  2. T-Gro commented on Jan 3, 2025

    @T-Gro
    Member
  3. edgarfgp commented on Jan 6, 2025

    @edgarfgp
    Contributor

    With the new properties DiagnosticId and FormatUrl the warning/errors message should account for this. Additionally we should consider converting the warning/error to use extended diagnostic feature so tooling can consume this and show in tooltips ?

  4. T-Gro commented on Jan 6, 2025

    @T-Gro
    Member

    Both of the properties should be exposed to tooling, yes .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions