Skip to content

[ScreenCaptureKit] Update bindings up to Xcode 27.0 Beta 4 - #26280

Merged
dalexsoto merged 4 commits into
xcode27.0from
dev/alex/xc27-ScreenCaptureKit
Jul 28, 2026
Merged

dalexsoto merged 4 commits into
xcode27.0from
dev/alex/xc27-ScreenCaptureKit

Conversation

@dalexsoto

Copy link
Copy Markdown
Member

Summary

  • enable ScreenCaptureKit on iOS 27 and tvOS 27 as a device-only framework while preserving Mac Catalyst 18.2 availability
  • bind the Xcode 27 clip-buffering, recording-editor, video-effect, stream-state, frame-info, and recording configuration APIs
  • update framework/linker registration, generated framework lists, xtro and documentation baselines, and simulator-only introspection handling
  • remove the obsolete ReplayKit SCStreamErrorDomain ignores now that ScreenCaptureKit is available on iOS and tvOS

The 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 world
  • clean xtro regeneration/classification: sanity passed
  • clean cecil suite: 112 passed, 4 skipped
  • native framework-linking tests: 8 passed
  • iOS introspection: 44 passed
  • tvOS introspection: 43 passed
  • macOS introspection: 32 passed, 2 host-version skips
  • Mac Catalyst: all fixtures outside the existing headless TCC-crashing constructor suite passed individually
  • clean app-size suite: 16 expected skips on beta Xcode, 0 failures

Runtime 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.

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
Copilot AI review requested due to automatic review settings July 24, 2026 00:20
@dalexsoto
dalexsoto requested a review from rolfbjarne as a code owner July 24, 2026 00:20
@dalexsoto dalexsoto added this to the xcode27 milestone Jul 24, 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.

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 ScreenCaptureKit as an iOS/tvOS 27.0 device-only framework and ensure Mac Catalyst stays available starting at 18.2.
  • Expand ScreenCaptureKit bindings 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.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto
dalexsoto enabled auto-merge (squash) July 24, 2026 02:21
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto

Copy link
Copy Markdown
Member Author

/azp run xamarin-macios-sim-pr-tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto dalexsoto changed the title [ScreenCaptureKit] Update bindings up to Xcode 27.0 Beta 3 [ScreenCaptureKit] Update bindings up to Xcode 27.0 Beta 4 Jul 27, 2026
Comment thread src/screencapturekit.cs Outdated
Comment thread tests/introspection/iOSApiFieldTest.cs Outdated
Comment thread tests/introspection/iOSApiSelectorTest.cs Outdated
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
@dalexsoto
dalexsoto requested a review from rolfbjarne July 27, 2026 15:49
@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto dalexsoto added the ready-to-review This PR is ready to review/merge. label Jul 27, 2026
@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto

Copy link
Copy Markdown
Member Author

/azp run xamarin-macios-sim-pr-tests

@azure-pipelines

Copy link
Copy Markdown
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
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
@dalexsoto

Copy link
Copy Markdown
Member Author

Addressed: the macOS test-runner fix is now in #26321 targeting main, and commit 2082758 removes it from this PR. Re-requesting review.

@dalexsoto
dalexsoto requested a review from rolfbjarne July 28, 2026 07:21
@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: 208275817352c04e41d9d586e9b1fe11da184d71 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

dalexsoto added a commit that referenced this pull request Jul 28, 2026
## 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
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [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
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. [attempt 2] 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 6 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. [attempt 2] 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. [attempt 2] 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. [attempt 2] Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Golden Gate (27): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 208275817352c04e41d9d586e9b1fe11da184d71 [PR build]

@dalexsoto
dalexsoto merged commit 4e2d944 into xcode27.0 Jul 28, 2026
55 checks passed
@dalexsoto
dalexsoto deleted the dev/alex/xc27-ScreenCaptureKit branch July 28, 2026 14:35
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