Skip to content

Add string array marshaling support for pass array#2244

Merged
manodasanW merged 2 commits intostaging/3.0from
manodasanw/stringArrayFix2
Feb 12, 2026
Merged

Add string array marshaling support for pass array#2244
manodasanW merged 2 commits intostaging/3.0from
manodasanw/stringArrayFix2

Conversation

@manodasanW
Copy link
Copy Markdown
Member

  • Fix string array marshaling for pass array scenarios. Making use of PinnedGCHandle to pin the string and also fixing the HSTRING_HEADER to ensure the contents are not relocated for the duration of the call where we need the HStringReference.
  • Enable some non-WinRT type arrays tests.
  • Made HStringReference an ref struct again given we are not using it as part of arrays, but did make HSTRING_HEADER public instead to allow it to be used in generated projections.

manodasanW and others added 2 commits February 11, 2026 19:31
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.
@manodasanW manodasanW merged commit 452855a into staging/3.0 Feb 12, 2026
11 checks passed
@manodasanW manodasanW deleted the manodasanw/stringArrayFix2 branch February 12, 2026 07:32
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants