Repository navigation
[Network] Retain borrowed content context metadata during callbacks - #26796
Conversation
The protocol definition and metadata passed to the content context iterator are borrowed native references. Construct both temporary callback wrappers with owns: false so they retain their own reference and disposal releases only that reference, rather than consuming references owned by the context or caller. Add a regression test that traverses the metadata twice and checks both native handles on each pass. Extract only this ownership fix and its test from #26704; synchronous enumeration 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
🟢 Approval recommended
The ownership fix matches NativeObject retain/release semantics and includes focused regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes native reference ownership during Network content metadata iteration.
Changes:
- Retains borrowed callback handles using
owns: false. - Adds regression coverage for repeated metadata traversal.
| File | Description |
|---|---|
src/Network/NWContentContext.cs |
Corrects callback wrapper ownership. |
tests/monotouch-test/Network/NWContentContextTest.cs |
Tests repeated metadata enumeration. |
✅ 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 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #06df41d] 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. [attempt 2] Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
The protocol definition and metadata passed to the content context iterator are borrowed native references. Construct both temporary callback wrappers with owns: false so they retain their own reference and disposal releases only that reference, rather than consuming references owned by the context or caller.
Add a regression test that traverses the metadata twice and checks both native handles on each pass. Extract only this ownership fix and its test from #26704; synchronous enumeration lifetime guards remain in that separate change.
🤖 Pull request created by Copilot