Migrate SpanArr inline array from InvalidCSharp*.il to C##123736
Migrate SpanArr inline array from InvalidCSharp*.il to C##123736
Conversation
… to C# Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
jkoritzinsky
left a comment
There was a problem hiding this comment.
@copilot the types that have been moved to C# can be moved out of the InvalidCSharp namespace and into the same namespace as the tests in their corresponding files.
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
|
@copilot it looks like there are transitive references to some of the types that were defined in InvalidCSharp.ilproj in the ByRefLike test suite. Please fix those failures by moving the requisite types back into IL. |
…k to IL Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Fixed in commit 93d4d2e. Moved |
|
@copilot there's 3 more types referenced from the InvalidCSharp.ilproj library that need to be moved back. Here's the error messages from the build: |
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
... Fixed in commit 67bb6f52. Moved |
|
@copilot move the types causing the following errors (and any transitive dependencies of them) back to IL: |
…e not valid in C# Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
... Fixed in commit 1d70f6b. Moved |
There was a problem hiding this comment.
@copilot Revert the changes in this file completely (back to the base branch's state) if we can't move any of the types due to transitive usage.
There was a problem hiding this comment.
Done in commit 102fe72. Reverted InvalidCSharp.il (ByRefLike) back to the base branch's state.
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Description
This PR migrates the
SpanArrinline array type fromInvalidCSharpInlineArray.ilto C# to reduce maintenance burden and demonstrate language evolution with C# 12+ inline arrays.After thorough investigation and multiple iterations addressing build failures, only the
SpanArrtype could be successfully migrated. All other types in theInvalidCSharp*.ilfiles must remain in IL due to either C# language limitations or IL self-referencing constraints.Changes
Ref Struct Inline Arrays (C# 12+) -
InlineArray/InvalidCSharpInlineArray.il→InlineArrayValid.csSpanArr- ref struct inline array with 100Span<object>elementsTypes Not Migrated
RefFields - C# language limitations:
WithRefField,WithRefStructField,WithTypedReferenceField<T>ByRefLike - IL self-referencing constraints:
ByRefLike/InvalidCSharp.ilremain unchanged (reverted to original state)Example
Before (IL):
After (C#):
Notes
InvalidCSharpInlineArray.ilandInlineArrayValid.cs💡 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.