Migrate ExtendedLayout test types from IL to C##123276
Merged
jkoritzinsky merged 4 commits intomainfrom Jan 28, 2026
Merged
Conversation
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update ExtendedLayout test suite to use new attribute
Migrate ExtendedLayout test types from IL to C#
Jan 16, 2026
Member
|
@copilot address the feedback from my review |
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Contributor
Author
src/tests/Loader/classloader/ExtendedLayout/ExtendedLayoutTypes.il
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates ExtendedLayout test type definitions from IL to C# now that the C# compiler supports the ExtendedLayoutAttribute. The migration moves type definitions to C# where possible while retaining IL types that require features C# cannot express.
Changes:
- Migrated 9 CStruct types and 9 CUnion types from IL to C# using the
ExtendedLayoutAttribute - Retained 9 IL types that require dual attributes or test invalid type scenarios
- Added shared helper types (
NestedSequentialType,NestedAutoLayoutType) in CStruct.cs for use across both test files
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ExtendedLayoutTypes.il | Removed migrated types; retained invalid test types and types requiring both ExtendedLayout and StructLayout/FieldOffset attributes |
| CStruct.cs | Added 9 CStruct type definitions and 2 shared nested helper types using ExtendedLayoutAttribute |
| CUnion.cs | Added 9 CUnion type definitions using ExtendedLayoutAttribute |
AaronRobinsonMSFT
approved these changes
Jan 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
The C# compiler now supports the
ExtendedLayoutAttribute. Migrated CStruct and CUnion type definitions from IL to C# where possible, keeping types that require bothStructLayoutandExtendedLayoutattributes in IL.Changes
CStruct.cs
[ExtendedLayout(ExtendedLayoutKind.CStruct)][StructLayout(LayoutKind.Auto)]onNestedAutoLayoutType), empty structs, and byref-like structsCUnion.cs
[ExtendedLayout(ExtendedLayoutKind.CUnion)]ExtendedLayoutTypes.il
NoExtendedAttributeOnType- tests missing attributeInlineArrayOnExtendedLayout- tests invalid attribute combinationExtendedLayoutInvalidKind- tests invalid enum valueExtendedLayoutandStructLayout/FieldOffsetattributes:CStructWithOffsets,CStructWithSize,CStructWithPackCUnionWithOffsets,CUnionWithSize,CUnionWithPackExample migration:
All existing tests remain unchanged - they reference the same type names, now defined in C# where possible and in IL where dual attributes are required.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.