Repository navigation
[src] Fix availability analyzer errors - #26369
Conversation
Add the missing platform contracts to version-gated wrappers and native callbacks. Suppress CA1422 where the analyzer cannot understand the existing SupportedOSPlatformGuard checks around legacy CoreVideo APIs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6987672a-aa50-405c-a61a-3656b3e567ca
There was a problem hiding this comment.
Pull request overview
This PR addresses platform availability analyzer warnings by adding explicit platform contracts to version-gated members (including unmanaged callback trampolines) and selectively suppressing analyzer warnings where existing guards canβt be correctly recognized.
Changes:
- Add
[SupportedOSPlatform]/[UnsupportedOSPlatform]annotations to version-gated wrappers and native callback trampolines. - Suppress CA1416/CA1422 in a few targeted call sites where analyzers currently misinterpret guarded/legacy APIs.
- Annotate newer APIs (iOS/tvOS/macOS/Mac Catalyst 26.0) with explicit platform contracts.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/VideoToolbox/VTDecompressionSession.cs | Adds platform attributes to unmanaged callback trampolines for multi-image decode APIs. |
| src/PdfKit/PdfViewAnnotationHitEventArgs.cs | Adds platform availability annotations to the event args type. |
| src/ObjCRuntime/Runtime.CoreCLR.cs | Adds a targeted CA1416 suppression around an ObjectiveCMarshal call site. |
| src/Foundation/NSObject2.cs | Adds a targeted CA1416 suppression around the [ObjectiveCTrackedType] usage. |
| src/CoreVideo/CVBuffer.cs | Adds targeted CA1422 suppressions around legacy CoreVideo attachment APIs guarded by SystemVersion. |
| src/CoreMedia/CMTaggedBufferGroup.cs | Adds iOS/tvOS/macOS/Mac Catalyst 26.0 availability to CreateFormatDescription. |
| src/CoreMedia/CMFormatDescription.cs | Adds platform attributes to tag-collection APIs/property related to multi-image support. |
| src/CoreGraphics/CGBitmapContext.cs | Adds platform attributes to unmanaged callback trampolines for adaptive bitmap context creation. |
Comments suppressed due to low confidence (2)
src/VideoToolbox/VTDecompressionSession.cs:426
- π€ β Platform attributes β Same issue as the other trampoline: this callback is only used by the macOS 14.0 / Mac Catalyst 17.0 entry points, but is annotated as "macos"/"maccatalyst" (all versions). Please match the versions to the DllImport/wrapper so the platform contract is accurate.
{Rule: Platform availability attributes}
[UnmanagedCallersOnly]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("ios17.0")]
[SupportedOSPlatform ("maccatalyst")]
[UnsupportedOSPlatform ("tvos")]
src/CoreMedia/CMFormatDescription.cs:844
- π€ β Platform attributes β
TagCollectionsshould have the same platform contract asGetTagCollections/CMVideoFormatDescriptionCopyTagCollectionArray(macOS 14.0, Mac Catalyst 17.0), but it's currently marked as "macos"/"maccatalyst" (all versions). Please align versions to avoid overstating availability.
{Rule: Platform availability attributes}
[SupportedOSPlatform ("ios17.0")]
[SupportedOSPlatform ("macos")]
[SupportedOSPlatform ("tvos17.0")]
[SupportedOSPlatform ("maccatalyst")]
β 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 #2498720] Test results πTest resultsβ All tests passed on VSTS: test results. π All 203 tests passed π Tests countsβ
assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS testsβ
Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Add the missing platform contracts to version-gated wrappers and native callbacks. Suppress CA1422 where the analyzer cannot understand the existing SupportedOSPlatformGuard checks around legacy CoreVideo APIs.
Copilot-Session: 6987672a-aa50-405c-a61a-3656b3e567ca