Repository navigation
[release/11.0.1xx] [ObjCRuntime] Add missing UserDelegateType attributes to block trampolines. - #27510
[release/11.0.1xx] [ObjCRuntime] Add missing UserDelegateType attributes to block trampolines.#27510rolfbjarne wants to merge 6 commits into
Conversation
…lines. (#27454) Add `[UserDelegateType]` to the trait change callbacks and all 99 other unannotated production block trampolines found by the new Cecil check. The check follows `BlockLiteral` constructor calls and verifies the annotation on the method used to calculate the block signature. Checking only delegate types passed to `GetDelegateForBlock<T>` would miss these unmanaged function-pointer callbacks. For callbacks that transform their arguments, use a delegate matching the native block signature rather than the public callback's signature. This changes metadata only, not callback implementations or public APIs. Follow-up to #26699. The separate token-identity fix is in #27447. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The cross-framework native block descriptor backport retains known callback ABI mismatches, and the Apple-platform runtime and CI validation needed to assess its safety was unavailable.
No open issues 🎉
What changed in this PR
Backports #27454 to release/11.0.1xx, adding delegate metadata used to generate native block signatures across the Apple platform bindings. Callback implementations and public APIs remain unchanged; separate callback ABI and trait-token identity fixes remain outside this PR.
Changes:
- Add missing
[UserDelegateType]attributes, using native-signature delegates where managed callbacks transform arguments. - Add Cecil validation, native-integer signature regressions, and a trait-change block-signature assertion.
- Refresh app-size expectations for iOS, tvOS, macOS, and Mac Catalyst.
| File | Description |
|---|---|
| tests/monotouch-test/UIKit/UITraitOverrides.cs | Annotates the test trampoline and verifies its block signature. |
| tests/monotouch-test/ObjCRuntime/BlocksTest.cs | Exposes the signature helper to other tests. |
| tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt | Refreshes tvOS trimmed NativeAOT sizes. |
| tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt | Refreshes tvOS NativeAOT sizes. |
| tests/dotnet/UnitTests/expected/TVOS-MonoVM-size.txt | Refreshes tvOS MonoVM sizes. |
| tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-size.txt | Refreshes tvOS MonoVM interpreter sizes. |
| tests/dotnet/UnitTests/expected/TVOS-CoreCLR-R2R-size.txt | Refreshes tvOS CoreCLR ReadyToRun sizes. |
| tests/dotnet/UnitTests/expected/TVOS-CoreCLR-Interpreter-size.txt | Refreshes tvOS CoreCLR interpreter sizes. |
| tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt | Refreshes macOS trimmed NativeAOT sizes. |
| tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt | Refreshes macOS NativeAOT sizes. |
| tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-R2R-size.txt | Refreshes macOS CoreCLR ReadyToRun sizes. |
| tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt | Refreshes macOS trimmed CoreCLR interpreter sizes. |
| tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt | Refreshes macOS CoreCLR interpreter sizes. |
| tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt | Refreshes Mac Catalyst trimmed NativeAOT sizes. |
| tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt | Refreshes Mac Catalyst NativeAOT sizes. |
| tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-size.txt | Refreshes Mac Catalyst MonoVM sizes. |
| tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-interpreter-size.txt | Refreshes Mac Catalyst MonoVM interpreter sizes. |
| tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-R2R-size.txt | Refreshes Mac Catalyst CoreCLR ReadyToRun sizes. |
| tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-Interpreter-size.txt | Refreshes Mac Catalyst CoreCLR interpreter sizes. |
| tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt | Refreshes iOS trimmed NativeAOT sizes. |
| tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt | Refreshes iOS NativeAOT sizes. |
| tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt | Refreshes iOS MonoVM sizes. |
| tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt | Refreshes iOS MonoVM interpreter sizes. |
| tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt | Refreshes iOS CoreCLR ReadyToRun sizes. |
| tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt | Refreshes iOS CoreCLR interpreter sizes. |
| tests/cecil-tests/BlittablePInvokes.cs | Detects missing metadata on block-constructor trampolines. |
| tests/assembly-preparer/OptimizeGeneratedCodeHandlerTests.cs | Tests four optimized native-integer block signatures. |
| src/VideoToolbox/VTRawProcessingSession.cs | Annotates parameter-change and output callbacks. |
| src/VideoToolbox/VTMotionEstimationSession.cs | Annotates the motion-estimation output callback. |
| src/VideoToolbox/VTDecompressionSession.cs | Annotates decompression output callbacks. |
| src/VideoToolbox/VTCompressionSession.cs | Annotates the compression output callback. |
| src/UIKit/UITraitChangeObservable.cs | Annotates the production trait-change callback. |
| src/UIKit/UIGuidedAccessRestriction.cs | Annotates the accessibility-configuration callback. |
| src/UIKit/UIAccessibility.cs | Annotates the guided-access callback. |
| src/Security/SecTrust.cs | Annotates asynchronous trust-evaluation callbacks. |
| src/Security/SecSharedCredential.cs | Annotates shared-credential callbacks. |
| src/Security/SecProtocolMetadata.cs | Annotates protocol-metadata callbacks. |
| src/Security/SecIdentity2.cs | Annotates certificate-access callbacks. |
| src/PassKit/PKPayLaterView.cs | Annotates the amount-validation callback. |
| src/ObjCRuntime/Blocks.cs | Annotates the shared dispatch-block trampoline. |
| src/Network/NWWebSocketResponse.cs | Adds header-enumerator signature metadata. |
| src/Network/NWWebSocketRequest.cs | Adds header and subprotocol signature metadata. |
| src/Network/NWWebSocketOptions.cs | Adds native client-request signature metadata. |
| src/Network/NWWebSocketMetadata.cs | Annotates the pong callback. |
| src/Network/NWTxtRecord.cs | Adds native TXT-record callback signatures. |
| src/Network/NWProxyConfig.cs | Annotates domain-enumeration callbacks. |
| src/Network/NWProtocolStack.cs | Annotates protocol iteration. |
| src/Network/NWProtocolDefinition.cs | Annotates the framer-start callback. |
| src/Network/NWPathMonitor.cs | Annotates path-update callbacks. |
| src/Network/NWPath.cs | Annotates interface and gateway enumeration. |
| src/Network/NWParameters.cs | Annotates configuration and interface callbacks. |
| src/Network/NWMulticastGroup.cs | Annotates endpoint enumeration. |
| src/Network/NWListener.cs | Annotates listener event callbacks. |
| src/Network/NWFramerMessage.cs | Annotates message-value callbacks. |
| src/Network/NWFramer.cs | Adds native framer callback signatures. |
| src/Network/NWEthernetChannel.cs | Annotates Ethernet channel callbacks. |
| src/Network/NWEstablishmentReport.cs | Adds native report-enumerator signatures. |
| src/Network/NWDataTransferReport.cs | Annotates report collection. |
| src/Network/NWContentContext.cs | Annotates protocol-metadata iteration. |
| src/Network/NWConnectionGroup.cs | Annotates connection-group callbacks. |
| src/Network/NWConnection.cs | Annotates connection event and data callbacks. |
| src/Network/NWBrowseResult.cs | Adds native interface-enumerator metadata. |
| src/Network/NWBrowser.cs | Annotates browser change and state callbacks. |
| src/MetalPerformanceShaders/MPSImageBatch.cs | Adds the native integer iterator signature. |
| src/Metal/MTLDevice.cs | Annotates device-notification callbacks. |
| src/MediaAccessibility/MediaAccessibility.cs | Annotates profile callbacks. |
| src/ImageIO/CGImageMetadata.cs | Annotates metadata-tag enumeration. |
| src/ImageIO/CGImageAnimation.cs | Defines and applies a native animation signature. |
| src/CoreText/CTLine.cs | Defines and applies a native caret signature. |
| src/CoreText/CTFontManager.cs | Annotates font registration and request callbacks. |
| src/CoreText/CTFontDescriptor.cs | Adds the native font-matching callback signature. |
| src/CoreGraphics/CGRenderingBufferProvider.cs | Annotates buffer-provider callbacks. |
| src/CoreGraphics/CGPDFArray.cs | Adds the native array-enumerator signature. |
| src/CoreGraphics/CGBitmapContext.cs | Annotates adaptive bitmap callbacks. |
| src/CoreFoundation/DispatchIO.cs | Annotates the dispatch I/O callback. |
| src/AudioUnit/AudioComponent.cs | Annotates validation callbacks. |
| src/AudioToolbox/AudioConverter.cs | Annotates preparation-completion callbacks. |
| src/AddressBook/ABAddressBook.cs | Annotates access-request callbacks. |
| src/Accessibility/AXSettings.cs | Annotates settings-completion callbacks. |
Review effort: Balanced
✅ 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 #01738fe] Test results 🔥Test results❌ Tests failed on VSTS: test results 1 tests crashed, 4 tests failed, 258 tests passed. Failures❌ dotnettests tests (MacCatalyst)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ linker tests (iOS)1 tests failed, 30 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (iOS)1 tests failed, 24 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (tvOS)1 tests failed, 24 tests passed.Failed tests
Html Report (VSDrops) Download ❌ windows tests🔥 Failed catastrophically on VSTS: test results - windows (no summary found). Html Report (VSDrops) Download Successes✅ 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 |
|
There was a problem hiding this comment.
🔵 Needs a closer look
The cross-framework native block descriptor backport retains deferred callback ABI mismatches, requiring human assessment of native SDK signatures and Apple-runtime/CI results beyond the new metadata-only checks.
No open issues 🎉
Review effort: Balanced
✅ 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 #a7c8445] Prepare .NET Release succeeded ✅📦 Published NuGet packages (32 packages)iOS
MacCatalyst
macOS
tvOS
Other
Pipeline on Agent |
🔥 [CI Build #4d59134] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 264 tests passed. Failures❌ monotouch tests (iOS)1 tests failed, 24 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ 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 |
🔥 [CI Build #4d59134] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 240 tests passed. Failures❌ monotouch tests (iOS) [attempt 2]# Test run in progress: Built: 1, Succeeded: 22, Ignored: 338, Crashed: 1, TimedOut: 1Failed tests
Html Report (VSDrops) Download Successes✅ 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 |
🔥 [CI Build #4d59134] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 2 tests failed, 263 tests passed. Failures❌ monotouch tests (iOS) [attempt 3]2 tests failed, 23 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ 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 |
🔥 [CI Build #4d59134] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 240 tests passed. Failures❌ monotouch tests (iOS) [attempt 4]# Test run in progress: Built: 3, Succeeded: 20, Ignored: 338, TimedOut: 2Failed tests
Html Report (VSDrops) Download Successes✅ 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 |
…backport-27454-to-11-0 Resolve the conflicts in the expected app size files by applying this PR's CI-validated size changes on top of the release branch's values (#27492): lines changed on only one side keep that side's value, and lines changed on both sides use release + (PR - merge base). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The adaptive-bitmap annotations still generate incorrect native block descriptors by encoding integer fields as pointers, affecting all four callbacks and requiring corrected signatures and descriptor regression tests.
1 open issue
Review effort: Balanced
|
|
||
| public delegate bool OnResolveCallback (ref CGContentInfo contentInfo, ref CGBitmapParameters bitmapParameters); | ||
|
|
||
| [UserDelegateType (typeof (OnResolveCallback))] |
✅ 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 #c3d30bc] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 3 tests failed, 262 tests passed. Failures❌ linker tests (iOS)1 tests failed, 30 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (iOS)2 tests failed, 23 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ 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 |
🔥 [CI Build #c3d30bc] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 2 tests failed, 263 tests passed. Failures❌ monotouch tests (iOS) [attempt 2]2 tests failed, 23 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ 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 |
🔥 [CI Build #c3d30bc] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 240 tests passed. Failures❌ monotouch tests (iOS) [attempt 3]# Test run in progress: Built: 3, Succeeded: 20, Ignored: 338, TimedOut: 2Failed tests
Html Report (VSDrops) Download Successes✅ 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 |
🔥 [CI Build #c3d30bc] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 264 tests passed. Failures❌ monotouch tests (iOS) [attempt 4]1 tests failed, 24 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ 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 |
🔥 [CI Build #c3d30bc] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 264 tests passed. Failures❌ monotouch tests (iOS) [attempt 5]1 tests failed, 24 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ 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 |

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
01738fe43068c0187cea91bdcbe35e017f4bb3ce↓ CI has not run; sizes were regenerated locally.
↓ No runtime-specific test covers every callback.
Add
[UserDelegateType]to the trait change callbacks and other unannotated production block trampolines found by the new Cecil check.The check follows
BlockLiteralconstructor calls and verifies the annotation on the method used to calculate the block signature. Checking only delegate types passed toGetDelegateForBlock<T>would miss these unmanaged function-pointer callbacks.For callbacks that transform their arguments, use a delegate matching the native block signature rather than the public callback's signature. This changes metadata only, not callback implementations or public APIs.
Follow-up to #26699. The separate token-identity fix is in #27447.
The release branch lacks #26855, so its
NWWebSocketOptionsclient-request trampoline still returnsvoidand uses anActionhandler. This backport adds the native-signature delegate metadata without changing the existing implementation. A separate Network/VideoToolbox callback ABI follow-up and a backport of #26797 are in progress. The backport of #26798, #27493, is now included in the release base.App-size expectations were regenerated on Xcode 27.2 (27B52) using the prescribed
AppSizeTestworkflow. CI may use a different Xcode or SDK build; its first run will confirm the generated sizes.Backport of #27454.
🤖 Pull request created by Copilot