-
Notifications
You must be signed in to change notification settings - Fork 841
Description
The interop team has decided to add a new mechanism to specify type layouts. In particular, the team has decided to use the last remaining value in the "Layout Kind" mask of a type def's attributes to represent "extended layout". When this value it set, the runtime will look for the System.Runtime.InteropServices.ExtendedLayoutAttribute to provide all layout information.
As part of the design process, we noticed that Roslyn blocks emitting a type with the last remaining value of the System.Runtime.InteropServices.LayoutKind enumeration in the StructLayout pseudo-attribute as the compiler can't map it to a valid TypeAttributes value. I do not know if F# does the same today.
The System.Runtime.InteropServices.ExtendedLayoutAttribute type was approved in dotnet/runtime#100896 and has the first part of runtime implementation (the TypeAttributes bit and the LayoutKind value) in dotnet/runtime#116082.
The support in F# should be either:
- Allow the user to specify the ExtendedLayoutAttribute on a type. When they do so, the correct layout bit will be set. The user cannot manually specify the new "extended layout" value. The only way in F# to specify that value is to put this attribute on the type.
- Disallow the
FieldOffsetattribute for extended layout types.
- Disallow the
- Block user usage of
ExtendedLayoutAttribute.
There is a PR to add support to Roslyn for C# and VB.NET at dotnet/roslyn#78741
Metadata
Metadata
Assignees
Labels
Type
Projects
Status