Add string array marshaling support for pass array#2244
Merged
manodasanW merged 2 commits intostaging/3.0from Feb 12, 2026
Merged
Add string array marshaling support for pass array#2244manodasanW merged 2 commits intostaging/3.0from
manodasanW merged 2 commits intostaging/3.0from
Conversation
Add a new HStringHeader struct for fast-pass HSTRING headers and refactor array marshalling to use it. Move HSTRING_HEADER to an internal type with public union fields to expose the underlying layout, remove the array conversion/Dispose helpers from HStringMarshaller, and implement array-specific ConvertToUnmanagedUnsafe and Dispose in HStringArrayMarshaller. Update code generation (code_writers.h) to allocate/pool HStringHeader arrays and call HStringArrayMarshaller accordingly. These changes separate single-value and array marshalling logic, tighten pinning requirements, and improve pooling behavior.
Sergio0694
approved these changes
Feb 12, 2026
kythant
pushed a commit
that referenced
this pull request
Feb 12, 2026
* Add string array marshaling support for pass array * Introduce HStringHeader and refactor marshalling Add a new HStringHeader struct for fast-pass HSTRING headers and refactor array marshalling to use it. Move HSTRING_HEADER to an internal type with public union fields to expose the underlying layout, remove the array conversion/Dispose helpers from HStringMarshaller, and implement array-specific ConvertToUnmanagedUnsafe and Dispose in HStringArrayMarshaller. Update code generation (code_writers.h) to allocate/pool HStringHeader arrays and call HStringArrayMarshaller accordingly. These changes separate single-value and array marshalling logic, tighten pinning requirements, and improve pooling behavior. --------- Co-authored-by: Sergio Pedri <sergio0694@live.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PinnedGCHandleto pin the string and also fixing theHSTRING_HEADERto ensure the contents are not relocated for the duration of the call where we need theHStringReference.HStringReferencean ref struct again given we are not using it as part of arrays, but did makeHSTRING_HEADERpublic instead to allow it to be used in generated projections.