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

Attributes broken net 9 #270

Open
atlemann opened this issue Feb 26, 2025 · 2 comments
Open

Attributes broken net 9 #270

atlemann opened this issue Feb 26, 2025 · 2 comments

Comments

@atlemann
Copy link

atlemann commented Feb 26, 2025

Attribute usage doesn't compile on net9

type ImportArgs =
    | [<Mandatory>] Name of name: string

Gives me this error for the Mandatory attribute:

error FS0842: This attribute is not valid for use on this language element
@atlemann
Copy link
Author

atlemann commented Feb 26, 2025

Funnily enough, if I copy the attribute code and put it above the ImportArgs, it stops complaining

/// Demands at least one parsed result for this argument; a parse exception is raised otherwise.
[<AttributeUsage(AttributeTargets.Class ||| AttributeTargets.Method ||| AttributeTargets.Property, AllowMultiple = false)>]
type MandatoryAttribute () = inherit Attribute ()

type ImportArgs =
    | [<Mandatory>] Name of name: string

@eiriktsarpalis
Copy link
Member

Tracked by dotnet/fsharp#18298

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants