Skip to content

[msbuild] Detect legacy UIKit lifecycle apps built against SDK 27 - #26936

Merged
rolfbjarne merged 9 commits into
mainfrom
dev/rolf/scene-lifecycle-validation
Oct 27, 2026
Merged

rolfbjarne merged 9 commits into
mainfrom
dev/rolf/scene-lifecycle-validation

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Apps that still use the legacy UIKit lifecycle can build successfully with Xcode 27, then crash at launch on iOS or macOS 27. Detect the common missing-scene-manifest case during the build instead, with an actionable error for developers and AI assistants.

Validate the final merged Info.plist for iOS and Mac Catalyst apps built against SDK 27.0 or later. If UIApplicationSceneManifest is missing or is not a dictionary, report MT7199 with migration guidance at https://aka.ms/uiscene. Developers can opt out using <ValidateSceneManifest>false</ValidateSceneManifest>; this only disables the build check, not Apple's runtime requirement.

  • Skip app extensions, frameworks, libraries, other platforms, and older SDKs.
  • Accept an empty dictionary for apps that supply scene configurations dynamically. This is a manifest heuristic, not a verification of delegate or window wiring.
  • Set the property default in Xamarin.Shared.props and track it in the manifest compilation inputs so toggling validation invalidates incremental outputs.
  • Do not write the compiled manifest after validation fails, preventing a later build from skipping the failed check.
  • Document the diagnostic and property, with task-level coverage and iOS/Mac Catalyst build regressions.

Note

🤖 Pull request created by Copilot

rolfbjarne and others added 3 commits October 20, 2026 17:55
Validate the merged iOS and Mac Catalyst app manifest when building against SDK 27.0 or later, before legacy-lifecycle apps reach their native launch-time crash. Report MT7198 with migration guidance at https://aka.ms/uiscene and an explicit ValidateSceneManifest=false escape hatch.

Exclude app extensions, frameworks, other Apple platforms and older SDKs. Accept dynamically configured scenes with an empty manifest dictionary, and include the opt-out in incremental-build inputs. Do not write a successful-looking manifest after validation fails, so repeated builds cannot bypass the error.

Document the property and diagnostic, and cover SDK boundaries, manifest types, partial manifests, exclusions, opt-out behavior and incremental revalidation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move the conditional ValidateSceneManifest=true default from Xamarin.Shared.targets to Xamarin.Shared.props alongside the app-manifest defaults, following the existing property initialization convention. Keep task wiring and incremental-build inputs unchanged, and continue to preserve explicit opt-out values.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Check that the compiled manifest task item is present before using its path in the new scene lifecycle tests. Fail explicitly when the helper's required output is missing instead of suppressing nullable analysis.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 16:19
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner October 20, 2026 16:19

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 default build-blocking validation and incremental-build behavior need SDK 27 Apple-platform CI confirmation.

No open issues 🎉

What changed in this PR

Adds build-time detection of missing UIKit scene manifests for iOS and Mac Catalyst apps targeting SDK 27 or later.

Changes:

  • Adds MT7198 validation of the merged manifest and prevents output writes after validation errors.
  • Introduces a default-enabled opt-out property tracked by incremental builds.
  • Adds task and build regression tests, plus diagnostic and property documentation.
File Description
tests/​msbuild/​Xamarin.MacDev.Tasks.Tests/​TaskTests/​CompileAppManifestTaskTests.cs Tests validation conditions and merged manifests.
tests/​dotnet/​UnitTests/​PartialAppManifestTest.cs Tests validation failures, opt-out, and incremental rebuilding.
msbuild/​Xamarin.Shared/​Xamarin.Shared.targets Passes and tracks the validation property.
msbuild/​Xamarin.Shared/​Xamarin.Shared.props Enables validation by default.
msbuild/​Xamarin.MacDev.Tasks/​Tasks/​CompileAppManifest.cs Implements scene validation and stops writes on failure.
msbuild/​Xamarin.Localization.MSBuild/​MSBStrings.resx Adds the localized diagnostic source.
docs/​website/​mtouch-errors.md Documents MT7198 and migration guidance.
docs/​building-apps/​build-properties.md Documents validation scope and opt-out.

Review effort: Balanced

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne added backport-to-net11.0 Add this to issues or pull requests that should be backported to .NET 11 backport-to-net10.0 Add this to issues or pull requests that should be backported to .NET 10 labels Oct 21, 2026
Bring in the seven latest base-branch commits, preserving both the new codesigning extended-attribute diagnostic and the scene lifecycle validation.

Resolve the E7198 resource collision by keeping the base branch's codesigning resource at E7198 and moving the scene lifecycle diagnostic to E7199/MT7199. Update the task, diagnostic documentation and regression assertions consistently.

Validation: all 58 focused CompileAppManifestTaskTests and CodesignTaskTests passed; the merged English resource file parses as XML.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 08:28

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 default-on SDK 27 build check needs Apple-platform CI confirmation, including incremental regression coverage.

1 open issue

Review effort: Balanced

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Migrate MySingleView to create its window in a scene delegate, and move MyCatalystApp's storyboard into its scene configuration with a registered scene delegate. Both UI apps can now use the scene lifecycle required by SDK 27 without bypassing manifest validation.

Explicitly disable ValidateSceneManifest for generated console-only fixtures, MaxSupportedOSPlatformVersion, and VeryManyRegisteredAssemblies. These executables do not start UIKit, so requiring a scene manifest would obscure the build and registrar behavior they are intended to test. The shared generated-project change also covers the remote Windows entitlements test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 14:01

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

SDK 27 enforcement and migrated app launch paths need Apple-platform CI and runtime validation before approval.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Preserve both the UIKit scene lifecycle error and main's new macOS HTTP handler warning when resolving the adjacent resource additions. Keep the scene diagnostic at MT7199 and retain the incoming dependency, build, and test updates.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 14:19

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

Default-on build enforcement and scene-lifecycle migrations need platform CI and launch-test confirmation that is not available in this review.

No open issues 🎉

Review effort: Balanced

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

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 default-on SDK 27 validation and scene lifecycle migrations still need Apple-platform CI results and app launch verification.

No open issues 🎉

Review effort: Balanced

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

rolfbjarne added a commit that referenced this pull request Oct 23, 2026
… against SDK 27 (#26988)

Apps that still use the legacy UIKit lifecycle can build successfully with Xcode 27, then crash at launch on iOS or macOS 27. Detect the common missing-scene-manifest case during the build instead, with an actionable error for developers and AI assistants.

Validate the final merged `Info.plist` for iOS and Mac Catalyst apps built against SDK 27.0 or later. If `UIApplicationSceneManifest` is missing or is not a dictionary, report **MT7199** with migration guidance at https://aka.ms/uiscene. Developers can opt out using `<ValidateSceneManifest>false</ValidateSceneManifest>`; this only disables the build check, not Apple's runtime requirement.

- Skip app extensions, frameworks, libraries, other platforms, and older SDKs.
- Accept an empty dictionary for apps that supply scene configurations dynamically. This is a manifest heuristic, not a verification of delegate or window wiring.
- Set the property default in `Xamarin.Shared.props` and track it in the manifest compilation inputs so toggling validation invalidates incremental outputs.
- Do not write the compiled manifest after validation fails, preventing a later build from skipping the failed check.
- Document the diagnostic and property, with task-level coverage and iOS/Mac Catalyst build regressions.

> [!NOTE]
> 🤖 Pull request created by Copilot

Backport of #26936.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

rolfbjarne and others added 2 commits October 26, 2026 09:29
Preserve main's MT7199 framework-extension warning and assign MT7200 to the UIKit scene lifecycle error. Update the scene validator, its regression expectations, and the diagnostic reference so each message retains a unique code.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The scene lifecycle diagnostic has already been backported as MT7199, so preserve that number across branches. Assign MT7200 to the framework-extension warning instead, and update its resource, emission site, regression expectations, and documentation consistently.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 08:56

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 build-blocking validation, incremental-build behavior, and scene lifecycle migrations still require Apple-platform CI and launch verification.

No open issues 🎉

Review effort: Balanced

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

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #b5805e3] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 217 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. [attempt 3] 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 1 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 21 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 21 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 20 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. [attempt 8] 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): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: b5805e3f2b9f849e10934999bc777a484c457712 [PR build]

@rolfbjarne
rolfbjarne merged commit 78efc25 into main Oct 27, 2026
56 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/scene-lifecycle-validation branch October 27, 2026 12:25
rolfbjarne added a commit that referenced this pull request Oct 27, 2026
… against SDK 27 (#26989)

Apps that still use the legacy UIKit lifecycle can build successfully
with Xcode 27, then crash at launch on iOS or macOS 27. Detect the
common missing-scene-manifest case during the build instead, with an
actionable error for developers and AI assistants.

Validate the final merged `Info.plist` for iOS and Mac Catalyst apps
built against SDK 27.0 or later. If `UIApplicationSceneManifest` is
missing or is not a dictionary, report **MT7199** with migration
guidance at https://aka.ms/uiscene. Developers can opt out using
`<ValidateSceneManifest>false</ValidateSceneManifest>`; this only
disables the build check, not Apple's runtime requirement.

- Skip app extensions, frameworks, libraries, other platforms, and older SDKs.
- Accept an empty dictionary for apps that supply scene configurations dynamically. This is a manifest heuristic, not a verification of delegate or window wiring.
- Set the property default in `Xamarin.Shared.props` and track it in the manifest compilation inputs so toggling validation invalidates incremental outputs.
- Do not write the compiled manifest after validation fails, preventing a later build from skipping the failed check.
- Document the diagnostic and property, with task-level coverage and iOS/Mac Catalyst build regressions.

> [!NOTE]
> 🤖 Pull request created by Copilot

Backport of #26936.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-net10.0 Add this to issues or pull requests that should be backported to .NET 10 backport-to-net11.0 Add this to issues or pull requests that should be backported to .NET 11 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