You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Area-Compiler-SigFileGengeneration of signature files - both compiler and IDEBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.
@nojaf Are you sure it's specifically about private constructors? I can reproduce it without adding the type to implementation file, so neither constructor nor its visibility change anything. I think the compiler wants to say that it can't decide which representation to use, based on the single property member in the signature file.
Expected behaviour
This should have [<Class>] attribute.
I think the rules are a bit more complicated than this. Consider this, for example:
[<Struct>]typeAprivate(i: int)=membera.Foo=1
The compiler suggests to use Class, Struct, or Sealed, so we need to choose the attribute accordingly.
Adding private new: unit -> A to the signature removes the need to add the attribute.
Whether the attribute should be Class does indeed depend on what the actual type is.
However, I do believe structs are generated correctly.
Area-Compiler-SigFileGengeneration of signature files - both compiler and IDEBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.
Activity
auduchinok commentedon Jan 16, 2024
@nojaf Are you sure it's specifically about private constructors? I can reproduce it without adding the type to implementation file, so neither constructor nor its visibility change anything. I think the compiler wants to say that it can't decide which representation to use, based on the single property member in the signature file.
I think the rules are a bit more complicated than this. Consider this, for example:
The compiler suggests to use
Class,Struct, orSealed, so we need to choose the attribute accordingly.nojaf commentedon Jan 16, 2024
Adding
private new: unit -> Ato the signature removes the need to add the attribute.Whether the attribute should be
Classdoes indeed depend on what the actual type is.However, I do believe structs are generated correctly.
auduchinok commentedon Jan 16, 2024
Btw, what is generated for private type representations?
Something like this?
nojaf commentedon Jan 16, 2024
Run the compiler with
--allsigsflag and you will know 😉.Fix missing [<Class>] attribute in signatures for types without visib…
Fix missing [<Class>] attribute in signatures for types without visib…
Fix missing [<Class>] attribute in signatures for types without visib…
Address signature generation bugs (dotnet#19586)