Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 8, 2025

This PR documents a breaking change introduced in .NET 10 Preview 7 where specifying explicit Size to a struct decorated with InlineArrayAttribute is now disallowed and throws a TypeLoadException.

Changes Made

  • Added: New breaking change document at docs/core/compatibility/core-libraries/10.0/inlinearray-explicit-size-disallowed.md
  • Updated: docs/core/compatibility/10.0.md to include the new breaking change in the Core .NET libraries table
  • Updated: docs/core/compatibility/toc.yml to add navigation entry for the new document

Breaking Change Details

Previous behavior: Specifying explicit Size on structs with InlineArrayAttribute 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.


Internal previews

📄 File 🔗 Preview link
docs/core/compatibility/10.0.md Breaking changes in .NET 10
docs/core/compatibility/core-libraries/10.0/inlinearray-explicit-size-disallowed.md Specifying explicit struct Size disallowed with InlineArray
docs/core/compatibility/toc.yml docs/core/compatibility/toc

Copilot AI changed the title [WIP] [Breaking change]: Specifying explicit struct Size is not disallowed with InlineArray Document InlineArray explicit Size breaking change for .NET 10 Aug 8, 2025
Copilot AI requested a review from gewarren August 8, 2025 22:54
@gewarren gewarren requested a review from VSadov August 11, 2025 18:27
@gewarren gewarren marked this pull request as ready for review August 11, 2025 18:27
@gewarren gewarren requested a review from a team as a code owner August 11, 2025 18:27
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, once @VSadov approves.

Copy link
Member

@VSadov VSadov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@gewarren gewarren merged commit 75ef2aa into main Aug 13, 2025
10 checks passed
@gewarren gewarren deleted the copilot/fix-47435 branch August 13, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Breaking change]: Specifying explicit struct Size is not disallowed with InlineArray

4 participants