Document InlineArray explicit Size breaking change for .NET 10 #47906
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR documents a breaking change introduced in .NET 10 Preview 7 where specifying explicit
Size
to a struct decorated withInlineArrayAttribute
is now disallowed and throws aTypeLoadException
.Changes Made
docs/core/compatibility/core-libraries/10.0/inlinearray-explicit-size-disallowed.md
docs/core/compatibility/10.0.md
to include the new breaking change in the Core .NET libraries tabledocs/core/compatibility/toc.yml
to add navigation entry for the new documentBreaking Change Details
Previous behavior: Specifying explicit
Size
on structs withInlineArrayAttribute
resulted in implementation-specific behavior that might not match user expectations.New behavior: Starting in .NET 10 Preview 7, such usage now throws a
TypeLoadException
when creating instances or performing other operations on these types.Type: Binary incompatible change - existing binaries may fail to load or execute and require recompilation.
Reason: The explicit
Size
specification for inline array structs is ambiguous and contradicts the specification.Recommended action: Use wrapper structs when explicit size specification is needed for either array elements or the whole inline array.
The documentation follows established patterns and Microsoft Writing Style Guide principles, providing clear explanations and actionable guidance for developers affected by this change.
Fixes #47435.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.