Repository navigation
[Network] Fix WebSocket response header bindings - #26800
Conversation
Return a native boolean from the response header enumeration trampoline and match its function-pointer signature so enumeration continues through every header. Forward transient header-name and value pointers to the native overload instead of recursively calling the managed string overload. Add a regression test that sets two headers and verifies successful enumeration and both values. Extract only these binding corrections from #26704; native-owner lifetime guards remain in that separate change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The trampoline incorrectly reports continuation when its managed callback target is unavailable.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Fixes native interop for WebSocket response headers and adds regression coverage.
Changes:
- Corrects enumeration callback return ABI.
- Forwards transient native string pointers correctly.
- Tests two-header enumeration.
| File | Description |
|---|---|
src/Network/NWWebSocketResponse.cs |
Fixes callback and header forwarding bindings. |
tests/monotouch-test/Network/NWWebSocketResponseTest.cs |
Adds regression coverage. |
Return false from the native enumeration trampoline when its managed target is missing, and report continuation only after delivering the header to the handler. This matches the failure behavior of the other Network enumeration trampolines. Document EnumerateAdditionalHeaders, including callback arguments, synchronous invocation, completion status, and null-handler validation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
🚀 [CI Build #2b77610] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 221 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |

Fix two binding errors in
NWWebSocketResponse:byte, with1to continue enumeration) from the additional-header callback, and update its function-pointer signature to match. The previousvoidcallback did not provide the continuation result expected by Network.framework.nw_ws_response_add_additional_headeroverload. Passing the original strings recursively called the managed wrapper instead.Add a regression test that sets two headers and verifies that enumeration completes and returns both names and values.
This independently extracts only the binding fixes and their test from #26704. All
GC.KeepAliveguards and associated result locals remain in that separate change.🤖 Pull request created by Copilot