Skip to content

Share some array code between CoreCLR and NativeAOT #116903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Jul 2, 2025

Conversation

huoyaoyuan
Copy link
Member

Shares the major logic of Copy and Clear, cleared some others.

Using coreclr behavior has source of truth. NativeAOT didn't support primitive widen for enum->enum.

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 22, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 22, 2025
@filipnavara
Copy link
Member

Good job. At least the System.Tests.ArrayTests.Copy_SourceAndDestinationPointers_ThrowsArrayTypeMismatchException test failure on windows/osx-arm64 seems relevant.

@huoyaoyuan
Copy link
Member Author

At least the System.Tests.ArrayTests.Copy_SourceAndDestinationPointers_ThrowsArrayTypeMismatchException test failure on windows/osx-arm64 seems relevant.

Yes I've mentioned it, I'm having trouble for running nativeaot tests locally, or mapping the throwing offset to code.

@filipnavara
Copy link
Member

Not sure if it helps but in debug build it asserts here:

  Process terminated. Assertion failed.
  we expect type definitions here
     at System.Diagnostics.DebugProvider.Fail(String, String) + 0x50
     at System.Diagnostics.Debug.Fail(String, String) + 0x5c
     at System.Diagnostics.Debug.Assert(Boolean, String, String) + 0x48
     at System.Diagnostics.Debug.Assert(Boolean, String) + 0x2c
     at Internal.Runtime.MethodTable.get_NonArrayBaseType() + 0x80
     at Internal.Runtime.WellKnownEETypes.IsSystemObject(MethodTable*) + 0x48
     at System.Array.CanAssignArrayType(Array sourceArray, Array destinationArray) + 0x2f4
     at System.Array.CopyImpl(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) + 0x34c
     at System.Array.Copy(Array sourceArray, Array destinationArray, Int32 length) + 0x260
     at System.Tests.ArrayTests.<>c.<Copy_SourceAndDestinationPointers_ThrowsArrayTypeMismatchException>b__69_2() + 0x50
     at Xunit.Assert.RecordException(Action) + 0x54
     at System.Runtime!<BaseAddress>+0x295a608
     at System.Tests.ArrayTests.Copy_SourceAndDestinationPointers_ThrowsArrayTypeMismatchException() + 0x288

@huoyaoyuan
Copy link
Member Author

OK, I was thinking no exception was thrown and the pointer types passed assignment test, and figuring out which line passes. Thanks for pointing out the failing stack trace.

@jkotas
Copy link
Member

jkotas commented Jul 2, 2025

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@jkotas jkotas merged commit 48319f4 into dotnet:main Jul 2, 2025
168 of 183 checks passed
@huoyaoyuan huoyaoyuan deleted the array-shared branch July 2, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants