Skip to content

[VideoToolbox] Strongly type compression log transfer functions - #26638

Merged
dalexsoto merged 1 commit into
mainfrom
dev/alex/gh26006n11
Sep 16, 2026
Merged

dalexsoto merged 1 commit into
mainfrom
dev/alex/gh26006n11

Conversation

@dalexsoto

@dalexsoto dalexsoto commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #26006.

Companion .NET 10 backport: #26640.

Expose VTCompressionProperties.LogTransferFunction as
CMFormatDescriptionLogTransferFunction?, with a public
string? WeakLogTransferFunction for identifiers not represented by the enum.
Both retain the existing iOS, tvOS, macOS, and Mac Catalyst 27.0 availability.

Both properties explicitly map to the existing native compression key.
StrongDictionary uses [Export] to select a dictionary key, rather than an
Objective-C selector; ordinary [Wrap] properties are not the appropriate
mechanism here. The existing generator handles NSString conversion, missing
entries, and null removal without new manual wrappers or generator changes.

The change also:

  • Documents absent values, null removal, the typed getter's
    NotSupportedException for unknown identifiers, and the requirement that source
    image buffers match the log curve specified for a compression session.
  • Adds 11 dictionary-only regression cases for the documented Apple Log/Apple
    Log 2 identifiers, both access directions, native key/type storage, immutable
    dictionary reads, idempotent clearing, preservation of unrelated entries, and
    unknown/empty strings.
  • Corrects the weak-property introspection check to exclude DictionaryContainer
    types: their managed entries have no Objective-C argument semantics. Actual
    Objective-C classes and protocol interfaces remain covered, and existing
    exceptions remain intact.
  • Removes the single resolved documentation-baseline entry instead of adding a
    new exception.

Compatibility

This intentionally corrects the API shape introduced in the Xcode 27 previews.
No stable Xcode 27 reference packages have been published; existing stable APIs
are unaffected. Preview callers that pass strings to LogTransferFunction
should use WeakLogTransferFunction. No API-diff suppressions were added.

Validation

Built clean product baselines with make world, then rebuilt and installed the
fix with make all -j8 and make install -j8 for all four platforms.

  • Fresh xtro-sharpie gen-all and dotnet-classify: all four platforms completed;
    Sanity check passed, with no annotation-file changes.
  • Full Cecil suite: 116 passed, 4 skipped, 0 failed.
  • The new regression fixture rejected the original installed API before the fix
    was built (missing weak property and incompatible string/enum assignments).
  • Runtime results were checked using the actual NUnit footer, not just the
    simulator launcher's exit code.
Platform/runtime Full introspection New regression fixture
iOS 27.0 (24A434) 44 passed 11 passed
tvOS 27.0 (24J360) 43 passed 11 passed
macOS 26.6.2 (25G83) 32 passed, 2 ignored 11 OS-version skips
Mac Catalyst on macOS 26.6.2 39 passed, 4 ignored 11 OS-version skips

All final runtime runs had 0 failures. The desktop host is older than the new APIs' 27.0
requirement, so desktop runtime checks cannot exercise the new key; the iOS/tvOS
27 simulators do exercise all 11 regression cases. Build, Cecil, and xtro
validation cover the desktop assemblies as well.

Expose VTCompressionProperties.LogTransferFunction as a nullable
CMFormatDescriptionLogTransferFunction and retain public raw-string access
as WeakLogTransferFunction for custom and future log curve identifiers.

Map both properties to kVTCompressionPropertyKey_LogTransferFunction with
the existing StrongDictionary Export mechanism. This preserves native
NSString storage, nullable reads for missing entries, and key removal when
either property is assigned null, without manual wrappers or generator
changes.

Document the typed getter's NotSupportedException for unknown identifiers
and the requirement that source image buffers match the log curve specified
for a compression session. Remove the now-resolved documentation baseline
entry rather than adding another documentation exception.

Add eleven dictionary-only regression cases covering AppleLog and AppleLog2
with their documented native identifiers, both access directions, native
key/type storage, immutable dictionary reads, idempotent null removal,
preservation of unrelated entries, and unknown/empty raw strings.

Exclude DictionaryContainer types from the Objective-C weak-property
argument-semantics check. Their managed accessors represent dictionary
entries, not exported Objective-C properties; real Objective-C classes and
protocols remain covered.

This is an intentional correction to an API published only in Xcode 27
previews. Preview callers using strings should use WeakLogTransferFunction.

Fixes #26006.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 69674cb3-59ff-4ee0-bc35-9032e499d428
Copilot AI lite review requested due to automatic review settings September 16, 2026 13:25
@dalexsoto dalexsoto added this to the xcode27 milestone Sep 16, 2026

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.

🔵 Needs a closer look

The binding still needs the nullability annotation and legacy API compatibility updates before approval.

Pull request overview

This pull request strongly types VTCompressionProperties.LogTransferFunction while retaining weak string access and adding validation coverage.

Changes:

  • Adds typed and weak log-transfer-function properties.
  • Adds dictionary conversion and unknown-value regression tests.
  • Updates introspection handling and documentation baselines.
File summaries
File Reviewed changes
src/videotoolbox.cs Adds the typed and weak properties; compatibility and nullability annotations require updates.
tests/monotouch-test/VideoToolbox/VTCompressionPropertiesTest.cs Adds regression coverage for storage, conversion, clearing, and unknown values.
tests/introspection/ApiWeakPropertyTest.cs Excludes dictionary containers; redundant exception branches should be cleaned up.
tests/cecil-tests/Documentation.KnownFailures.txt Removes the resolved documentation baseline entry.
Review details

Suppressed comments (3)

src/videotoolbox.cs:959

  • ⚠️ Codebase conventions — This new enum-valued StrongDictionary entry can be absent, and both its XML docs and regression tests expose null. Strong-dictionary binding definitions mark nullable value-type entries with [NullAllowed] (for example, src/coremedia.cs:38-66); add the attribute here so the binding definition records the valid null value instead of relying only on the generator's nullable wrapper.
		CMFormatDescriptionLogTransferFunction LogTransferFunction { get; set; }

src/videotoolbox.cs:959

  • ❌ error — This removes the previously exposed string LogTransferFunction member and replaces it with a differently typed property, which is a source-breaking API change for consumers of the Xcode 27 preview. The established compatibility pattern keeps the old member behind #if !XAMCORE_5_0 with an [Obsolete] migration message (see src/foundation.cs:23263-23268); please preserve that legacy surface while exposing this typed member in the new branch, with WeakLogTransferFunction as the escape hatch.
		CMFormatDescriptionLogTransferFunction LogTransferFunction { get; set; }

tests/introspection/ApiWeakPropertyTest.cs:18

  • 💡 Maintainability — This type-level skip now makes the dictionary-specific branches in iOSApiWeakPropertyTest.Skip (PropertyInfo) and MacApiWeakPropertyTest.Skip (Type) unreachable for NSAttributedStringDocumentAttributes, UIFontAttributes, UIStringAttributes, and VNImageOptions. Please remove those redundant exceptions or narrow this skip so the test's exception list reflects code paths it still exercises.
			if (typeof (DictionaryContainer).IsAssignableFrom (type))
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

❗ API diff for current PR / commit (Breaking changes)

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: dc85e91ccc8c93290817a415a52dc9cc28c9ea3b [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #dc85e91] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 1 tests failed, 263 tests passed.

Failures

❌ linker tests (iOS)

1 tests failed, 30 tests passed.

Failed tests

  • trimmode copy/iOS - simulator/Release: LaunchTimedOut

Html Report (VSDrops) Download

Successes

✅ 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 7 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 31 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 25 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 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
⚠️ Tests on macOS Golden Gate (27): Tests skipped, incorrect beta version. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: dc85e91ccc8c93290817a415a52dc9cc28c9ea3b [PR build]

@dalexsoto
dalexsoto merged commit f97abbf into main Sep 16, 2026
52 of 56 checks passed
@dalexsoto
dalexsoto deleted the dev/alex/gh26006n11 branch September 16, 2026 18:22
dalexsoto added a commit that referenced this pull request Sep 16, 2026
…fer functions (#26640)

## Summary

Backport of #26638 to `release/10.0.1xx`, addressing #26006. The
four-file patch
is identical to the .NET 11 change and was independently built and
tested with
the .NET 10 SDK.

Expose `VTCompressionProperties.LogTransferFunction` as
`CMFormatDescriptionLogTransferFunction?`, with a public
`string? WeakLogTransferFunction` for custom and future identifiers.
Both retain
the existing 27.0 availability on iOS, tvOS, macOS, and Mac Catalyst.

Both properties explicitly map to the same native compression key using
`StrongDictionary`'s `[Export]` mechanism. The existing generator
handles native
`NSString` conversion, missing entries, and null removal; no ordinary
`[Wrap]`,
manual wrapper, or generator change is needed.

The patch also adds meaningful XML documentation and 11 dictionary-only
regression cases, removes the resolved documentation-baseline entry, and
corrects weak-property introspection to exclude managed
`DictionaryContainer`
entries from Objective-C argument-semantics checks. Actual Objective-C
classes
and protocol interfaces remain covered.

## Compatibility

This intentionally corrects an API published only in Xcode 27 previews.
No
stable Xcode 27 reference packages have been published. Preview callers
passing
strings should switch to `WeakLogTransferFunction`; stable APIs are
unaffected.
No API-diff suppressions were added.

The typed getter returns null for an absent entry, but throws
`NotSupportedException` for an unknown non-null identifier. The public
weak
property preserves access to those identifiers. Documentation also
explains
that source buffers must match the log curve specified for a compression
session; the property does not request an encoder-side conversion.

## Independent .NET 10 validation

- Completed a clean `make world` baseline, then rebuilt and installed
the fix
  with `make all -j8` and `make install -j8` for all four platforms.
- Regenerated xtro references and ran `dotnet-classify` on all four
platforms:
  **Sanity check passed**, with no annotation-file changes.
- Full Cecil suite: **116 passed, 4 skipped, 0 failed**.
- Verified actual NUnit result footers instead of relying on launcher
exit codes.

| Platform/runtime | Full introspection | New regression fixture |
| --- | --- | --- |
| iOS 27.0 (`24A434`) | 43 passed, 1 ignored | 11 passed |
| tvOS 27.0 (`24J360`) | 42 passed, 1 ignored | 11 passed |
| macOS 26.6.2 (`25G83`) | 32 passed, 2 ignored | 11 OS-version skips |
| Mac Catalyst on macOS 26.6.2 | 39 passed, 4 ignored | 11 OS-version
skips |

All final runtime runs had **0 failures**. The existing iOS/tvOS
introspection
ignore is `TypoTest` (#25397), unchanged by this PR. The desktop host is
older
than the new APIs' 27.0 requirement, so the new desktop regression cases
are
correctly skipped; all 11 cases execute on the iOS/tvOS 27 simulators.
Build,
Cecil, and xtro validation cover the desktop assemblies as well.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 69674cb3-59ff-4ee0-bc35-9032e499d428
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[VideoToolbox] Add strongly typed LogTransferFunction to VTCompressionProperties

4 participants