-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Description
Applying explicit Size to a struct decorated with InlineArrayAttribute is ambiguous and now is not supported in the type Loader.
.NET 10 Preview 7
Version
Other (please put exact version in description textbox)
Previous behavior
Previously specifying explicit Size
would result in implementation specific behavior that may or may not match user's expectations
New behavior
Creating instances of such struct and other uses will result in TypeLoadException thrown.
Type of breaking change
- Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
- Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
- Behavioral change: Existing binaries might behave differently at run time.
Reason for change
Specifying Size
for an inline array struct is ambiguous and any interpretation would contradict specification.
Recommended action
In unlikely case if user needs to specify explicit size either for the array element or for the whole inline array, a struct wrapping the element type or the whole array type can be introduced and in the layout of the wrapper the Size
could be specified accordingly and unambiguously.
Feature area
Other (please put exact area in description textbox)
Affected APIs
Affects: TypeLoader. The loader may reject types that were not originally rejected.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status