Skip to content

[release/11.0.1xx-rc2] Fix JNI jchar marshalling on CoreCLR - #12881

Merged
jonathanpeppers merged 1 commit into
release/11.0.1xx-rc2from
backport/pr-12870-to-release/11.0.1xx-rc2
Sep 23, 2026
Merged

jonathanpeppers merged 1 commit into
release/11.0.1xx-rc2from
backport/pr-12870-to-release/11.0.1xx-rc2

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport of #12870 to release/11.0.1xx-rc2

/cc @jonathanpeppers

## Changes

- marshal JNI `jchar` values as `ushort` at the unmanaged function-pointer boundary while preserving the public managed `char` API
- add on-device return-value regressions for `Java.Lang.String.CharAt()` and `SpannableStringBuilder.CharAt()` across representative UTF-16 values, including `U+FFFF` to cover unsigned 16-bit behavior
- add an on-device field regression covering `U+FFFF` input through `SetCharField` and output through `GetCharField`

## Validation

- reproduced both `CharAt()` failures on Android API 37 with CoreCLR: expected `U+00E4`, received `U+FFFD`
- verified both `CharAt()` regression tests pass after the fix, including `U+FFFF`
- verified the `U+FFFF` char-field write/read regression passes on CoreCLR
- rebuilt `Java.Interop`, `Mono.Android`, and the final Mono.Android test project

Fixes #12865

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers
jonathanpeppers merged commit 08cf9c5 into release/11.0.1xx-rc2 Sep 23, 2026
42 of 44 checks passed
@jonathanpeppers
jonathanpeppers deleted the backport/pr-12870-to-release/11.0.1xx-rc2 branch September 23, 2026 01:03
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants