[ScreenCaptureKit] Update bindings up to Xcode 27.0 Beta 4 - #26280
Conversation
Enable ScreenCaptureKit on iOS and tvOS as a device-only framework while preserving its existing Mac Catalyst 18.2 availability. Bind the Xcode 27 clip buffering, recording editor, video-effect, stream-state, frame-info, and recording configuration APIs with exact per-platform availability and nullable NSError outputs. Update framework registration, linker expectations, generated framework/define lists, xtro and documentation baselines, and simulator-only introspection handling. Remove the obsolete ReplayKit SCStreamErrorDomain ignores now that ScreenCaptureKit is bound on iOS and tvOS. Validation: make world; clean xtro and cecil suites; framework-linking tests; iOS, tvOS, macOS, and Mac Catalyst introspection; clean AppSizeTest run. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f09fc2f9-a071-47c6-84ff-02aa45e9e0c0
There was a problem hiding this comment.
Pull request overview
Updates ScreenCaptureKit support across Apple platforms to align with Xcode 27.0 Beta 3 APIs, including enabling the framework on iOS/tvOS (device-only) while preserving Mac Catalyst availability and updating test/baseline infrastructure accordingly.
Changes:
- Register
ScreenCaptureKitas an iOS/tvOS 27.0 device-only framework and ensure Mac Catalyst stays available starting at 18.2. - Expand
ScreenCaptureKitbindings to cover newly introduced Xcode 27 API surface (clip buffering, recording editor, video effects, stream state/frame info, etc.). - Refresh repo baselines and tests (xtro todo cleanup + new ignores, introspection skips for simulator, linker/registrar framework expectations, documentation known-failures).
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/common/Frameworks.cs | Adds ScreenCaptureKit to iOS/tvOS framework lists as device-only and adjusts Mac Catalyst availability/versioning. |
| tests/xtro-sharpie/api-annotations-dotnet/tvOS-ScreenCaptureKit.todo | Removes resolved xtro todo entries after binding completion. |
| tests/xtro-sharpie/api-annotations-dotnet/tvOS-ScreenCaptureKit.ignore | Adds ignores for known xtro limitations (availability placement + block nullability analysis). |
| tests/xtro-sharpie/api-annotations-dotnet/tvOS-ReplayKit.ignore | Drops obsolete SCStreamErrorDomain ignore now that ScreenCaptureKit is present on tvOS. |
| tests/xtro-sharpie/api-annotations-dotnet/macOS-ScreenCaptureKit.todo | Removes resolved xtro todo entries after binding completion. |
| tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-ScreenCaptureKit.todo | Removes resolved xtro todo entries after binding completion. |
| tests/xtro-sharpie/api-annotations-dotnet/iOS-ScreenCaptureKit.todo | Removes resolved xtro todo entries after binding completion. |
| tests/xtro-sharpie/api-annotations-dotnet/iOS-ScreenCaptureKit.ignore | Adds ignores for known xtro limitations (availability placement + block nullability analysis). |
| tests/xtro-sharpie/api-annotations-dotnet/iOS-ReplayKit.ignore | Drops obsolete SCStreamErrorDomain ignore now that ScreenCaptureKit is present on iOS. |
| tests/mtouch/RegistrarTest.cs | Updates MT4134 invalid-framework list for iOS to include ScreenCaptureKit 27.0. |
| tests/introspection/iOSApiSelectorTest.cs | Skips ScreenCaptureKit selector introspection on simulator where the framework is absent. |
| tests/introspection/iOSApiProtocolTest.cs | Skips ScreenCaptureKit protocol introspection on simulator where the framework is absent. |
| tests/introspection/iOSApiFieldTest.cs | Skips ScreenCaptureKit field introspection on simulator where the framework is absent. |
| tests/introspection/iOSApiCtorInitTest.cs | Skips ScreenCaptureKit ctor/init introspection on simulator where the framework is absent. |
| tests/introspection/ApiTypoTest.cs | Adds ScreenCaptureKitLibrary to the device-only ConstantsCheck allowlist. |
| tests/dotnet/UnitTests/ProjectTest.cs | Updates expected framework lists to include ScreenCaptureKit for iOS/tvOS (LinkMode=None expectations). |
| tests/cecil-tests/Documentation.KnownFailures.txt | Updates documentation baseline entries for newly bound ScreenCaptureKit APIs. |
| src/ScreenCaptureKit/SCContentFilter.cs | Limits SCContentFilter convenience constructors to macOS/Mac Catalyst builds (platform-guarded). |
| src/screencapturekit.cs | Main binding updates/additions for new Xcode 27 ScreenCaptureKit API surface and platform availability. |
| src/rsp/dotnet/tvos-defines-dotnet.rsp | Defines HAS_SCREENCAPTUREKIT for tvOS .NET builds. |
| src/rsp/dotnet/ios-defines-dotnet.rsp | Defines HAS_SCREENCAPTUREKIT for iOS .NET builds. |
| src/frameworks.sources | Moves ScreenCaptureKit into COMMON_FRAMEWORKS to enable it across supported platforms. |
| src/build/dotnet/generator-frameworks.g.cs | Adds ScreenCaptureKit to generated framework lists used by the build/tooling. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/azp run xamarin-macios-sim-pr-tests |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Mark the iOS and tvOS ScreenCaptureKit API surface as unavailable in simulators so introspection uses binding metadata instead of namespace-specific skips. Use platform type aliases for SCRecordingEditor presentation APIs, allowing all platform-specific selectors to remain in one binding definition without member-level preprocessor branches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f09fc2f9-a071-47c6-84ff-02aa45e9e0c0
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/azp run xamarin-macios-sim-pr-tests |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
…rives late
The 'arm64 - Mac Golden Gate (27) macOS tests' job failed twice on this PR even
though every test passed:
5 suites passed, 0 suites failed.
Wrote 792232215 bytes to .../DiagnosticReports/system.log
Unhandled exception. System.ObjectDisposedException: Cannot write to a closed TextWriter.
at System.IO.StreamWriter.WriteLine(String value)
at Program.<>c__DisplayClass0_1.<<Main>$>b__11(Object _, DataReceivedEventArgs e)
at System.Diagnostics.AsyncStreamReader.FlushMessageQueue(Boolean rethrowInNewThread)
We run 'log stream' with both stdout and stderr redirected to asynchronous
handlers that write to a StreamWriter. On shutdown we SIGINT it and call
WaitForExit (10_000), but that overload only waits for the process to exit, not
for the asynchronous handlers to finish delivering buffered output - the same
caveat ExecuteWithTimeout already documents. So a queued line could still be
delivered after the writer was disposed and throw on a thread pool thread,
which is unhandled and fails the job even when all the tests passed. The
several hundred megabytes of 'log stream' output make the window easy to hit
on a loaded bot.
Guard the writes with a flag set under the same lock the handlers already take,
so a late callback becomes a no-op instead of an unhandled exception, and stop
reading once we're done. Also drain the handlers before disposing so we don't
lose the tail of the log, but do it on a background thread with a timeout: the
parameterless WaitForExit () can block indefinitely if anything still holds the
redirected pipes, and hanging the job for hours would be worse than the crash
this fixes.
Note this is a test-infrastructure fix rather than a ScreenCaptureKit change.
It is included here because the bug reproducibly blocks this PR's CI.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ebf4376b-3b4c-4492-acef-18607e6f4ea1
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rolfbjarne
left a comment
There was a problem hiding this comment.
The last commit ("[tests] Don't crash the macOS test runner when 'log stream' output arrives late") should be a separate PR targeting main, and then removed from this PR.
If this PR really needs that fix, the fix will flow from main to xcode27.0, and once the fix is in xcode27.0 merge xcode27.0 into this PR's branch.
Move the macOS test-runner race fix to #26321 targeting main, as requested in review. Keep this PR focused on the ScreenCaptureKit binding update; the infrastructure fix can flow from main to xcode27.0 independently if needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f09fc2f9-a071-47c6-84ff-02aa45e9e0c0
✅ 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 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
## Summary - prevent late asynchronous `log stream` callbacks from writing after the diagnostic `StreamWriter` is closed - bound SIGINT, force-termination, and output-drain waits so cleanup cannot hang test jobs - report drain, flush, and disposal failures without failing an otherwise successful test run ## Root cause The macOS 27 test leg twice completed all suites successfully, then failed while shutting down diagnostic logging: ``` 5 suites passed, 0 suites failed. Unhandled exception. System.ObjectDisposedException: Cannot write to a closed TextWriter. ``` `WaitForExit (10_000)` waited for the process but not the asynchronous output handlers, so buffered `DataReceived` callbacks could arrive after writer disposal. This was split from #26280 at reviewer request so the infrastructure fix can flow through `main` independently. ## Validation - built `scripts/run-packaged-macos-tests/run-packaged-macos-tests.csproj` with 0 warnings and 0 errors - independent GPT-5.6 Sol and Claude Opus 4.8 max-reasoning concurrency reviews --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ebf4376b-3b4c-4492-acef-18607e6f4ea1 Copilot-Session: f09fc2f9-a071-47c6-84ff-02aa45e9e0c0
🚀 [CI Build #2082758] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 200 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Summary
SCStreamErrorDomainignores now that ScreenCaptureKit is available on iOS and tvOSThe ScreenCaptureKit headers are identical between Xcode 27 Beta 3 and the current Beta 4 branch baseline; validation used the current Beta 4 checkout.
Validation
make worldRuntime coverage
ScreenCaptureKit is absent from the iOS/tvOS simulator SDKs, so those APIs are exercised by CI device legs. The new macOS/Mac Catalyst 27.0 APIs are host-gated locally on macOS 26.5 and will be exercised by the macOS 27 CI legs.