Repository navigation
[WIP] [iOS] Fix DeviceDisplay Orientation Not Updating on Device Rotation - #39403
Shalini-Ashokan wants to merge 3 commits into
Conversation
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39403Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39403" |
|
Hey there @@Shalini-Ashokan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 1 findings
See inline comments for details.
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@Shalini-Ashokan — new AI review results are available based on commit
83ff724.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ⚠️ SKIPPED
No tests were detected in this PR.
Recommendation: Add tests to verify the fix using the write-tests-agent.
📋 Pre-Flight — Context & Validation
Pre-Flight Context
PR scope
- PR: #39403, open draft, targeting
main. - Immutable comparison: base
51cf98f249bbb18aacfa0d35e5add1f50bf5fc38; head83ff7246b94f86a7491abe82b574bcd5b9268d9c. - Size: One modified file, 32 additions and 10 deletions:
src/Essentials/src/DeviceDisplay/DeviceDisplay.ios.cs
- No test files or public APIs are changed.
Reported problem
Linked issue #39182 reports that on iOS 27:
DeviceDisplay.Current.MainDisplayInfo.OrientationremainsPortraitafter rotation.MainDisplayInfoChangeddoes not fire.- A later issue comment also reports
MainDisplayInfo.Rotationremaining atRotation0.
A maintainer reports reproducing this with .NET MAUI 10.0.0 and 10.0.110 on iOS 27, while iOS 26.5 reportedly works. The issue is labeled as a verified potential regression, but the exact first affected MAUI or iOS build remains unknown. The issue body has no public reproduction repository; a later comment contains an attached project and video evidence, which were not inspected here.
The PR attributes the behavior to the deprecated status-bar orientation API no longer updating reliably on iOS 27. That causal explanation is reported context, not independently established by this pre-flight collection.
Changed mechanism
The submitted change replaces both parts of the old status-bar-based implementation:
-
Change notification
- Before: observes
UIApplication.DidChangeStatusBarOrientationNotification. - After: observes
UIDevice.OrientationDidChangeNotification.
- Before: observes
-
Orientation and rotation source
- Before: reads
UIApplication.SharedApplication.StatusBarOrientation. - After: reads
UIWindowScene.InterfaceOrientation.
- Before: reads
The new scene lookup:
- Enumerates
UIApplication.SharedApplication.ConnectedScenes. - Returns the first
UIWindowSceneinForegroundActive. - If none is active, retains the first
ForegroundInactivescene. - Returns no scene otherwise, producing
UIInterfaceOrientation.Unknown.
Existing rotation mappings remain unchanged: portrait maps to Rotation0, upside-down to Rotation180, landscape-left to Rotation270, and landscape-right to Rotation90. An unknown interface orientation produces DisplayRotation.Unknown; orientation calculation treats anything not recognized as landscape—including Unknown—as DisplayOrientation.Portrait.
The change also removes the method-level UnsupportedOSPlatform("ios13.0") annotation and the warning suppressions previously required by the deprecated UIApplication.StatusBarOrientation access.
Relevant event lifecycle
DeviceDisplay.shared.cs provides the surrounding behavior:
- The first
MainDisplayInfoChangedsubscriber snapshots the current metrics and starts the native listener. - Additional subscribers do not register additional native observers.
- A native notification recomputes the complete
DisplayInfo. - The public event is raised only when the recomputed value differs from the stored snapshot.
- Removing the last subscriber disposes the native observer.
Consequently, receiving UIDevice.OrientationDidChangeNotification is necessary but not sufficient for a public callback: UIWindowScene.InterfaceOrientation and the resulting DisplayInfo must already reflect a changed value when the callback executes.
Platform-sensitive paths
- Despite its
.ios.csname, this source is compiled for both iOS and Mac Catalyst. - The observer replacement is inside the non-
MACCATALYSTbranch, so it changes listener behavior only on iOS. Mac Catalyst retainsNSApplicationDidChangeScreenParametersNotification. - The new scene and orientation helpers are outside that conditional and therefore compile for both platforms.
- Normal Mac Catalyst display retrieval uses Core Graphics, hardcodes orientation to portrait, and derives rotation from
CGDisplayRotation. The shared fallback path can still reach the changed scene helpers if Core Graphics fails to return a display mode. - The PR carries both
platform/iosandplatform/macoslabels, although its stated validation checks only iOS. - No call to
UIDevice.BeginGeneratingDeviceOrientationNotificationsexists in the Essentials DeviceDisplay implementation. Other MAUI areas sometimes call it before observing the same notification, while at least one other path observes without doing so. Whether generation is already enabled reliably for this lifecycle requires platform validation. - Scene enumeration does not associate the selected scene with a particular MAUI window. Behavior with multiple foreground-active scenes therefore remains dependent on which matching scene is encountered first.
Existing coverage and gate evidence
- Existing unit tests cover
DisplayInfoequality and mockedIDeviceDisplaysubscription/start/stop behavior; they do not exercise UIKit notifications or scene orientation. - Existing Essentials device tests check positive width, height, and density and test
KeepScreenOn; they do not rotate an iOS device or verifyMainDisplayInfoChanged. - Gate:
⚠️ skipped because no tests were detected in this PR. It was not rerun. - The PR description marks iOS as manually validated and includes before/after video attachments, but does not identify the exact device versus simulator, iOS build, test sequence, or observed orientation/rotation values.
- Automation comments show pipelines were started, but their outcomes are unknown from the gathered context.
Validation requirements for the separate iOS review
Relevant validation should establish, without relying only on notification delivery:
- Initial
OrientationandRotationvalues in portrait and supported landscape/upside-down orientations. - Correct updates after clockwise and counterclockwise rotation on iOS 27.
- Delivery of
MainDisplayInfoChanged, with event arguments matchingDeviceDisplay.Current.MainDisplayInfo. - Listener behavior after subscribe, unsubscribe, and resubscribe.
- Whether orientation notifications are generated reliably without explicit begin/end generation calls.
- Whether
UIWindowScene.InterfaceOrientationhas updated by the time the device-orientation notification callback runs. - Suppression of unnecessary public events for physical orientations such as face-up or face-down when interface metrics do not change.
- Single-window, iPad multi-window, foreground-inactive, and no-eligible-scene behavior.
- Preservation of behavior on iOS 26.5 and supported earlier iOS versions.
- Successful Mac Catalyst compilation and, where feasible, unchanged normal and fallback behavior.
- Automated regression coverage for both the orientation value and event-delivery failure reported by #39182.
Remaining uncertainties
- Notification-generation requirements and callback timing relative to scene orientation updates are unverified.
- Selection behavior with multiple foreground-active scenes is unverified.
- Expected behavior when no active or inactive window scene exists is unspecified; the submitted code yields portrait orientation with unknown rotation.
- The exact iOS 27 regression boundary and underlying Apple behavior are unknown.
- The attached reproduction and videos were not examined.
- #39182 references another open closing PR; it was not examined or compared under this context-only boundary.
- This is a focused pre-flight context summary, not an exhaustive code review, recommendation, or selection between implementations.
🔬 Code Review — Deep Analysis
Code Review — PR #39403
Independent Assessment
What this changes: On iOS, the submitted fix replaces the deprecated status-bar-orientation notification and value with UIDevice.OrientationDidChangeNotification and the interface orientation of a foreground UIWindowScene. The listener remains scoped to the existing first-subscriber/last-unsubscriber lifecycle.
Inferred motivation: Restore MainDisplayInfo.Orientation, MainDisplayInfo.Rotation, and MainDisplayInfoChanged after rotation on iOS versions where status-bar orientation no longer tracks the active interface.
Reconciliation with PR Narrative
Author claims: iOS 27 no longer reliably updates the deprecated status-bar orientation API, and an active UIWindowScene supplies the modern replacement.
Agreement/disagreement: The diff implements that mechanism and preserves the existing rotation mapping. The submitted evidence does not establish notification timing, notification-generation requirements, multi-window scene selection, or regression behavior because no automated rotation/event test is included.
Prior Review Reconciliation
The trusted context does not retain complete prior-review bodies, so absence of prior error-level findings cannot be proven from the saved artifacts. The single expert pass produced one non-duplicate actionable finding against the submitted diff.
Blast Radius Assessment
- Runs for all instances: Yes for every iOS
DeviceDisplaylistener; the first public event subscriber installs the replacement notification globally for the singleton implementation. - Startup impact: No eager startup work; scene enumeration occurs when display information is read or the registered notification fires.
- Static/shared state: No new static mutable state. Scene selection is process-wide and is not associated with a particular MAUI window.
CI Status
- Required-check result: Undetermined from the trusted artifacts.
- Gate:
⚠️ SKIPPED — no tests detected in this PR. - Classification: No relevant automated regression evidence.
- Action taken: Confidence is capped at low; Gate was not rerun.
Findings
❌ Error — The reported regression has no automated regression test
src/Essentials/src/DeviceDisplay/DeviceDisplay.ios.cs:165 changes both the event producer and orientation source, but the submitted PR adds no test that rotates on iOS and verifies MainDisplayInfo.Orientation, MainDisplayInfo.Rotation, and MainDisplayInfoChanged. The existing shared event code raises the public event only after the newly queried DisplayInfo differs, so merely receiving the native notification does not prove the fix. A timing or scene-selection regression can therefore restore the reported stale values without a CI signal.
Failure-Mode Probing
- Subscribe, unsubscribe, and resubscribe: the existing observer field is disposed when the final subscriber is removed and recreated for a later first subscriber; the submitted change preserves that symmetry.
- Notification arrives before
UIWindowScene.InterfaceOrientationupdates: the callback recomputes immediately and suppresses the public event if metrics remain equal; the submitted PR has no test evidence that excludes this path. - Multiple foreground-active scenes: the first enumerated scene wins, independent of a MAUI window; the intended multi-window semantics and ordering are not established by submitted tests.
- No eligible scene: rotation becomes
Unknownwhile orientation falls through toPortrait; this fallback is unchanged in shape but newly reachable through scene lookup and is not covered.
External Output Contract
Not applicable.
Verdict: NEEDS_CHANGES
Confidence: low
Summary: The implementation is plausible and no source-proven production-code defect survived the one expert pass, but this bug fix changes platform notification and scene-selection behavior without the required regression test. Because Gate was skipped and the central event-delivery mechanism remains unvalidated, the submitted PR cannot be recommended for approval.
Refinement Threshold
Met only for a test-focused refinement. The expert finding is backed by the submitted diff (no test files), the shared event suppression path, and the trusted coverage inventory; a pr-plus-reviewer candidate may add focused automated regression coverage, but it must not change production behavior without additional source/test evidence.
🛠️ Try-Fix — Analysis & Comparison
Alternative generation: not requested
Evidence-first mode intentionally omits routine Try-Fix attempts. This is not a failed
attempt, a completed alternative search, or evidence that alternatives have no value.
The expert review may still produce one evidence-backed PR refinement.
📝 PR Finalize — Recommended Title & Description
Assessment: ✏️ Recommend updating — the title retains a [WIP] prefix, and the description overstates multi-window support without documenting the actual first-active-scene selection or the rotation value changed by submitted HEAD.
Recommended title
[iOS] DeviceDisplay: Update orientation after device rotation
Recommended description
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!!
-->
### Description of Change
#### Issue details
On iOS 27, `DeviceDisplay.Current.MainDisplayInfo.Orientation` remains `Portrait` and `MainDisplayInfo.Rotation` remains `Rotation0` when the device rotates. `MainDisplayInfoChanged` also does not fire, so apps cannot respond to orientation changes.
#### Root cause
iOS 27 no longer reliably updates the deprecated status-bar orientation API, causing MAUI to read stale orientation and rotation values and suppress the unchanged `MainDisplayInfoChanged` result.
#### Fix
Update `DeviceDisplay.ios.cs` to:
- Observe `UIDevice.OrientationDidChangeNotification` instead of the deprecated status-bar-orientation notification.
- Read `UIWindowScene.InterfaceOrientation` instead of `UIApplication.StatusBarOrientation`.
- Prefer the first foreground-active `UIWindowScene`, falling back to the first foreground-inactive scene when no active scene is available.
- Preserve the existing interface-orientation-to-`DisplayRotation` mapping.
This uses the modern scene-based orientation source and removes the deprecated status-bar API usage. Scene selection is process-wide and is not associated with a specific MAUI window.
#### Platforms validated
- [ ] Android
- [ ] Windows
- [x] iOS
- [ ] Mac
### Issues Fixed
Fixes #39182
<!--
Are you targeting main? All PRs should target the main branch unless otherwise noted.
-->
### Output recordings
| Before | After |
|---|---|
| <video src="https://github.com/user-attachments/assets/ad121485-ffe4-4cea-a06b-ab183fc772fa"> | <video src="https://github.com/user-attachments/assets/09259376-3939-488b-8818-e28c81b3cefe"> |
🏁 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Phase Status
| Phase | Status | Notes |
|---|---|---|
| Pre-Flight | ✅ COMPLETE | Trusted evidence-first context consumed; submitted head 83ff7246b94f86a7491abe82b574bcd5b9268d9c |
| Code Review | NEEDS_CHANGES (low) | 1 blocking regression-coverage finding |
| Gate | No tests were detected in the submitted PR; Gate was not rerun | |
| Try-Fix | Not requested | Evidence-first mode intentionally omitted routine alternatives |
| Refinement | ✅ IMPLEMENTED | One test-focused pr-plus-reviewer candidate; one targeted iOS test passed on iOS 26.5 |
| Report | ✅ COMPLETE |
Code Review and Candidate Comparison
| Candidate | Change | Validation | Expert finding | Rank |
|---|---|---|---|---|
pr |
Replaces the deprecated status-bar notification/value with UIDevice.OrientationDidChangeNotification and foreground UIWindowScene.InterfaceOrientation |
Gate skipped; no relevant automated test in submitted HEAD | Unresolved: no regression test for orientation, rotation, and event delivery | 2 |
pr-plus-reviewer |
Keeps the submitted production fix and adds a focused iOS Appium regression test | 1/1 filtered test passed after candidate-local build and install on iOS 26.5 | Addressed in code, but fail-without-fix behavior on iOS 27 remains unverified | 1 |
Selected Fix: pr-plus-reviewer. It is the only real candidate that addresses the expert finding and it passed the single permitted targeted run. Because those test changes are not in submitted HEAD, selecting it requires changes to the PR. The candidate is not demonstrated merge-ready: the available runtime was iOS 26.5, not the reported iOS 27 regression environment.
Summary
The submitted production mechanism is plausible, but the raw PR has no automated evidence for the user-visible regression and its Gate was skipped. Add the pr-plus-reviewer regression coverage to the PR and validate the orientation/rotation event path on iOS 27 before treating the fix as confirmed. The missing submitted test and skipped Gate each prevent approval.
Root Cause
The reported root cause is that iOS 27 no longer reliably updates the deprecated status-bar orientation API. MAUI consequently reads stale orientation/rotation values; because the shared event path publishes only when the recomputed DisplayInfo differs, the stale value also suppresses MainDisplayInfoChanged.
Fix Quality
The submitted change moves to scene-based interface orientation and preserves listener disposal and existing rotation mappings. Its first-active-scene selection and notification timing remain unverified for iOS 27 and multi-window cases. The refinement adds direct value/event coverage without altering production behavior and passes on iOS 26.5, but the unavailable iOS 27 runtime leaves the central regression boundary unresolved.
📱 UI Tests — Button,Label,Layout
Detected UI test categories: Button,Label,Layout
✅ Deep UI tests — 415 passed, 0 failed, 8 skipped across 3 categories on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
Button |
105/106 (1 skipped) ✓ | — |
Label |
113/115 (2 skipped) ✓ | — |
Layout |
197/202 (5 skipped) ✓ | — |
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs) |
🧭 Next Steps — reviewer changes required
The reviewer-enhanced candidate identified changes that are not yet in the submitted PR.
Why: The refinement preserves the submitted production fix while adding the expert-required orientation, rotation, and event regression coverage, and its focused candidate-local iOS test passed. It wins over the untested raw PR, but iOS 27 behavior remains unverified and the submitted PR still requires the refinement.
Address the actionable findings in this review before merging.
PR Test Gate
|
|
I have closed my PR in favor of the PR. |
…10) (#39879) <!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> .NET 10 servicing port targeting `release/10.0.1xx-sr13`, following up on #39398 and replacing #39870. Related alternative: #39403. Observe the selected window scene's effective geometry and reselect it as windows and scene lifecycle state change. Read metrics from that scene's screen so display dimensions, density and refresh rate follow Duo display handoffs, including geometry changes without physical device rotation. Orient dimensions using the scene's interface orientation when screen bounds lag during a handoff. On iOS 27+, detect scene-backed versus legacy operation at runtime, retaining orientation notifications when no usable scene is available. Preserve the older-iOS notification fallback and account for interface-oriented screen bounds. Mac Catalyst behavior is unchanged. No public API is added. #### Validation The commands below used the installed .NET 11 RC SDK against the .NET 10 targets, with `REPO_ROOT` set to the absolute path of the .NET 10 checkout: - **Passed:** 20 focused unit tests: ```sh cd /tmp && dotnet test "$REPO_ROOT/src/Essentials/test/UnitTests/Essentials.UnitTests.csproj" -c Debug -f net10.0 -p:_MauiDotNetTfm=net10.0 --no-restore --filter 'FullyQualifiedName~Tests.DeviceDisplay_Tests' --verbosity quiet ``` - **Passed:** production Essentials iOS build with 0 warnings and 0 errors: ```sh dotnet build "$REPO_ROOT/src/Essentials/src/Essentials.csproj" -c Debug -f net10.0-ios26.0 -p:_MauiDotNetTfm=net10.0 --no-restore --verbosity quiet ``` - **Simulator runtime, .NET 10 port:** a session-only MAUI app linked to the exact port-built Essentials assembly. The same scene geometry request changed the display from `1398 × 2034` portrait to `2034 × 1398` landscape without an additional physical-orientation notification. With the parent commit's DeviceDisplay sources there was no `MainDisplayInfoChanged` event; with this fix there was one event with the correct dimensions and rotation. - **Duo handoffs, .NET 10 port:** with the scene held in the same landscape orientation, opening the simulated Duo left the parent-commit app reporting the cover-screen `2034 × 1398` dimensions and no event. The fixed app emitted a new event reporting the inner-screen `2853 × 2007` dimensions, then another event returning to `2034 × 1398` on refolding; no additional physical-orientation notification occurred. Closed, open and partially open poses were exercised. - **No-manifest app:** the fixed assembly raised a correctly oriented event on both a current-runtime compatibility scene and an older iOS simulator. Opening and refolding the current-runtime compatibility app left its letterboxed virtual display unchanged, so no additional display event was expected or observed. - **Runtime caveat:** the .NET 10 probe used `ValidateXcodeVersion=false` with the installed Xcode 27 and .NET 10 iOS SDK, an unsupported toolchain combination. Its no-manifest variant also used a simulator-only iOS 26.5 linker SDK setting. Nine warnings came from the probe's diagnostic instrumentation, not the production Essentials build. - **Coverage limits:** physical hardware was not tested, and the committed device tests do not automate a real cross-screen handoff. - **Not validated locally:** device-test host compilation requires repository build tasks. Building `Microsoft.Maui.BuildTasks.slnf` failed while archiving MauiPlatformInterop under the installed Xcode (`xcodebuild` exit code 65); device tests were not run locally on this branch. The device-test CI pipeline has been requested. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #39182 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change Follow-up to #39398 for the remaining orientation and display-change failures reported in #39182, including [opening the Duo simulator without rotating it](#39182 (comment)). Physical device-orientation notifications are not sufficient: the interface geometry can change without another notification, and a scene can move to a different display while `UIScreen.MainScreen` still identifies the cover display. Reading scene orientation only inside the same physical-orientation callback, as proposed in the closed alternative #39403, also misses that handoff. On iOS 27 and later, this change: - Observes the selected `UIWindowScene`'s `effectiveGeometry` and reads orientation, rotation, density, refresh rate, and dimensions from that scene's screen. - Uses interface-oriented fixed-coordinate bounds so the first event is correct even when `UIScreen.Bounds` has not caught up with a rotation or display handoff. - Rebinds when windows and scenes become available, activate, background, or disconnect. Queued callbacks from an old listener are invalidated, and observers are removed when the last subscriber leaves. - Uses actual runtime scene availability rather than the presence of a scene manifest. If no usable scene exists, it uses the legacy screen/orientation path with balanced device-notification generation. Custom window-state-manager selection remains authoritative. The older-iOS path also observes status-bar orientation changes and corrects first-event bounds using interface orientation, without replacing its existing physical-orientation semantics. Mac Catalyst keeps its separate Core Graphics implementation. No public API changes or app-side warning suppressions are required. Adds geometry, lifecycle, scene-selection, fallback, bounds, and null-subscription regressions. The Essentials iOS device-test host now uses scenes; its headless scene delegate is shared with the existing Mac Catalyst host. #### Validation Using the locally installed .NET SDK and Xcode: | Command | Result | |---|---| | `dotnet test src/Essentials/test/UnitTests/Essentials.UnitTests.csproj -c Debug -f net11.0 --no-restore --filter 'FullyQualifiedName~Tests.DeviceDisplay_Tests' -v:q` | 20 passed | | `dotnet build src/Essentials/src/Essentials.csproj -c Debug -f net11.0-ios27.0 --no-restore -t:Rebuild -v:q` | Passed; 0 warnings, 0 errors | | `dotnet build src/Essentials/src/Essentials.csproj -c Debug -f net11.0-maccatalyst27.0 --no-restore -t:Rebuild -v:q` | Passed; 0 warnings, 0 errors | Both production builds used the normal analyzers and warnings-as-errors policy. Additional local XHarness runs: full iOS Essentials suite **299 passed, 2 skipped**; focused current-iOS suite **17 passed, 1 skipped**; genuine no-manifest older-iOS host **7 passed, 5 skipped**; Mac Catalyst Essentials suite **272 passed, 8 skipped**. Reproduced the missing event and stale Duo display metrics before the fix. Verified the fixed behavior in running MAUI simulator apps, not only assertions: closed/open/partial/refold transitions, same-orientation screen handoff, both scene-enabled and no-manifest lifecycles, older-runtime rotations, and multi-scene activation/disconnection with subsequent fallback rotations. Checked rendered screenshots and event/geometry traces. On the scene-enabled Duo, opening changed the reported display from 1398 x 2034 portrait to 2853 x 2007 landscape without another physical-orientation notification. #### Coverage limits - Simulator validation only; physical-device confirmation is still needed. - The genuine no-manifest host was exercised locally, not added as a separate CI host. UIKit's letterboxed compatibility mode keeps its virtual display when unfolding; no event is expected when those metrics do not change. - One reused-simulator run hit a UIKit orientation-request timeout; the focused fresh-simulator rerun and final full iOS run passed. - The fail-without-fix helper was blocked before either phase with `ERROR: COULD NOT FIND MERGE BASE`. The regression evidence above comes from independent original-code reproductions and fixed-build runs, not a successful helper verification. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #39182 Follow-up to #39398. Related closed alternative: #39403. <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details
On iOS 27, DeviceDisplay.Current.MainDisplayInfo.Orientation stays Portrait when the device rotates.The MainDisplayInfoChanged event also does not fire, so apps cannot respond to orientation changes.
Root Cause
iOS 27 no longer reliably updates the deprecated status-bar orientation API, so MAUI always reported Portrait and missed orientation-change events.
Description of Change
Listen for device-orientation changes and read the orientation from the active UIWindowScene.
The fix supports modern multi-window iOS applications and avoids the deprecated status-bar API.
Validated the behavior in the following platforms
Issues Fixed
Fixes #39182
Test case
This scenario cannot be covered by an automated test case.
Output ScreenShot
39182-Before.Fix.mov
39182-AfterFix.mov