Skip to content
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

Treat Char/Bool as requiring marshalling #113602

Merged
merged 4 commits into from
Mar 18, 2025

Conversation

MichalStrehovsky
Copy link
Member

Fixes #113599

@Copilot Copilot bot review requested due to automatic review settings March 17, 2025 08:20
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issue #113599 by adjusting the marshalling behavior for char and bool types. It updates the primitive type check in MarshalHelpers.Aot.cs and adds unit tests to verify the correct sizes for char and bool.

  • Updated IsStructMarshallingRequired condition to treat bool and char as requiring marshalling.
  • Added unit tests verifying that Marshal.SizeOf returns the expected values for char and bool.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.Aot.cs Updated the condition to ensure bool and char are not skipped from marshalling.
src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/SizeOfTests.cs Added tests to verify the expected sizes for char and bool marshalling.

@MichalStrehovsky
Copy link
Member Author

/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.

Thanks

…Aot.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@MichalStrehovsky
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MichalStrehovsky
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MichalStrehovsky
Copy link
Member Author

/ba-g unrelated wasm timeout

@MichalStrehovsky MichalStrehovsky merged commit 5512a46 into dotnet:main Mar 18, 2025
145 of 154 checks passed
@MichalStrehovsky MichalStrehovsky deleted the fix113599 branch March 18, 2025 05:51
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.

Marshal.SizeOf of bool and char report wrong value
2 participants