Skip to content

[src] Fix availability analyzer errors - #26369

Merged
rolfbjarne merged 1 commit into
mainfrom
dev/rolf/analyzer-errors-2026
Jul 31, 2026
Merged

rolfbjarne merged 1 commit into
mainfrom
dev/rolf/analyzer-errors-2026

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

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

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
Copilot AI review requested due to automatic review settings July 30, 2026 13:50
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner July 30, 2026 13:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — TagCollections should have the same platform contract as GetTagCollections/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")]

Comment thread src/VideoToolbox/VTDecompressionSession.cs
Comment thread src/CoreMedia/CMFormatDescription.cs
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 2498720f23ec60ca8243b51ac80f5c45ef869711 [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [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
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 19 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 2498720f23ec60ca8243b51ac80f5c45ef869711 [PR build]

@rolfbjarne
rolfbjarne enabled auto-merge (squash) July 31, 2026 13:58
@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Jul 31, 2026
@rolfbjarne
rolfbjarne merged commit 75f116b into main Jul 31, 2026
57 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/analyzer-errors-2026 branch July 31, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants