-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Type of issue
Missing information
Description
There is a new compiler-recognized attribute, ExtendedLayoutAttribute, intended for a user to write in source code. When this attribute is used, the type it is applied to may not have a StructLayout attribute, and IL metadata is emitted equivalent to [StructLayout(LayoutKind.Extended, Size=0, Pack=0)] for that type. LayoutKind.Extended is a new flag that causes TypeAttributes.ExtendedLayout to be specified in the numeric value of the emitted type flags.
This is of interest because [StructLayout(LayoutKind.Extended)] is not allowed to be written in code. To set that flag, you must use the ExtendedLayoutAttribute parameter.
Description of the general feature:
How the C# compiler behaves:
- https://github.com/dotnet/roslyn/blob/main/docs/features/ExtendedLayoutAttribute.md
- C# compiler integration with new System.Runtime.InteropServices.ExtendedLayoutAttribute roslyn#74705
Page URL
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/attributes/pseudo-attributes
Content source URL
Document Version Independent Id
e27e1497-736f-0bb3-abea-1bb11f6e8560
Platform Id
26b706b9-46d1-8f15-bfce-3b0e594eb5ff
Article author
Metadata
- ID: a7957a0a-90d6-51d4-8ed6-876b0c451f03
- PlatformId: 26b706b9-46d1-8f15-bfce-3b0e594eb5ff
- Service: dotnet-csharp
- Sub-service: lang-reference