Repository navigation
[VideoToolbox] Strongly type compression log transfer functions - #26638
Conversation
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
There was a problem hiding this comment.
🔵 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-valuedStrongDictionaryentry can be absent, and both its XML docs and regression tests exposenull. 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 LogTransferFunctionmember 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_0with an[Obsolete]migration message (seesrc/foundation.cs:23263-23268); please preserve that legacy surface while exposing this typed member in the new branch, withWeakLogTransferFunctionas 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)andMacApiWeakPropertyTest.Skip (Type)unreachable forNSAttributedStringDocumentAttributes,UIFontAttributes,UIStringAttributes, andVNImageOptions. 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
❗ API diff for current PR / commit (Breaking changes)NET (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 #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
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 |
…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
Summary
Fixes #26006.
Companion .NET 10 backport: #26640.
Expose
VTCompressionProperties.LogTransferFunctionasCMFormatDescriptionLogTransferFunction?, with a publicstring? WeakLogTransferFunctionfor 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.
StrongDictionaryuses[Export]to select a dictionary key, rather than anObjective-C selector; ordinary
[Wrap]properties are not the appropriatemechanism here. The existing generator handles
NSStringconversion, missingentries, and null removal without new manual wrappers or generator changes.
The change also:
NotSupportedExceptionfor unknown identifiers, and the requirement that sourceimage buffers match the log curve specified for a compression session.
Log 2 identifiers, both access directions, native key/type storage, immutable
dictionary reads, idempotent clearing, preservation of unrelated entries, and
unknown/empty strings.
DictionaryContainertypes: their managed entries have no Objective-C argument semantics. Actual
Objective-C classes and protocol interfaces remain covered, and existing
exceptions remain intact.
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
LogTransferFunctionshould use
WeakLogTransferFunction. No API-diff suppressions were added.Validation
Built clean product baselines with
make world, then rebuilt and installed thefix with
make all -j8andmake install -j8for all four platforms.xtro-sharpie gen-allanddotnet-classify: all four platforms completed;Sanity check passed, with no annotation-file changes.
was built (missing weak property and incompatible string/enum assignments).
simulator launcher's exit code.
24A434)24J360)25G83)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.