Skip to content

Fix incorrect DestinationPage in NavigationPage OnNavigatingFrom events - #35733

Merged
kubaflo merged 4 commits into
dotnet:inflight/currentfrom
Shalini-Ashokan:fix-35613
Jun 11, 2026
Merged

kubaflo merged 4 commits into
dotnet:inflight/currentfrom
Shalini-Ashokan:fix-35613

Conversation

@Shalini-Ashokan

@Shalini-Ashokan Shalini-Ashokan commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

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

In .NET MAUI, when navigating between pages using NavigationPage, the OnNavigatingFrom event fires with the wrong destination page. For example, navigating from Page A to Page B gives DestinationPage = A instead of B.

Root Cause

The method SendNavigating() inside NavigationPage was always using CurrentPage (the page you're leaving) as the destination in the event. At the time the event fires, CurrentPage hasn't changed yet — so the destination always pointed to itself instead of the actual next page.

Description of Change

Added a destinationPage parameter to SendNavigating() and updated all call sites to pass the correct target page — the pushed page for Push, the page below for Pop, and the root page for PopToRoot. This fix covers both the modern handler path and the legacy renderer path.

Validated the behavior in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #35613

Output ScreenShot

iOS

Before After
35613-iOS-Before.mov
35613-iOS-After.mov

Android

Before After
34613-Android-Before.mov
35613-Android-Afte.mov

@github-actions

github-actions Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35733

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35733"

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Jun 3, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jun 3, 2026
@vishnumenon2684

Copy link
Copy Markdown
Contributor

/azp run maui-pr-devicetests

@azure-pipelines

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

@github-actions github-actions Bot added the area-navigation NavigationPage label Jun 3, 2026
@Shalini-Ashokan Shalini-Ashokan changed the title [WIP] Fix incorrect DestinationPage in NavigationPage OnNavigatingFrom events Fix incorrect DestinationPage in NavigationPage OnNavigatingFrom events Jun 5, 2026
@kubaflo

kubaflo commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

/review -b feature/enhanced-reviewer -p android

@MauiBot MauiBot added s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Jun 7, 2026
MauiBot

This comment was marked as outdated.

@kubaflo kubaflo 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.

Is this PR ready?

@sheiksyedm
sheiksyedm marked this pull request as ready for review June 8, 2026 19:13
@sheiksyedm

Copy link
Copy Markdown
Contributor

Is this PR ready?

Yes, its ready.

@kubaflo

kubaflo commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

/review rerun

@github-actions github-actions Bot added the s/agent-ready-for-rerun AI review has a new PR-author comment or commit and is ready for rerun label Jun 10, 2026
@kubaflo

kubaflo commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

/review -b feature/enhanced-reviewer -p android

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Jun 11, 2026
@github-actions github-actions Bot removed the s/agent-ready-for-rerun AI review has a new PR-author comment or commit and is ready for rerun label Jun 11, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 1 findings

See inline comments for details.


public Issue35613()
{
Navigation.PushAsync(new Issue35613FirstPage());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[moderate] Regression Prevention and Test Coverage — This issue page stores its log in static state but never clears it when a new instance is created. Because the Appium assertions only use Does.Contain(...), rerunning this page/test in the same HostApp process can pass from stale entries even if the new navigation no longer fires the expected DestinationPage values. Clear the log before starting the scenario, e.g. before the initial PushAsync.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

@Shalini-Ashokan — new AI review results are available based on this last commit: 2a74f43.
Addressed the internal concerns To request a fresh review after new comments or commits, comment /review rerun.

Gate Passed Code Review In Review Confidence Medium Platform Android

Review Sessions — click to expand
Gate — Test Before & After Fix

Gate Result: ✅ PASSED

Platform: ANDROID · Base: main · Merge base: dd5b6d2e

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue35613 Issue35613 ✅ FAIL — 865s ✅ PASS — 1343s
🔴 Without fix — 🖥️ Issue35613: FAIL ✅ · 865s
  Determining projects to restore...
  Restored /home/vsts/work/1/s/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj (in 9.01 sec).
  Restored /home/vsts/work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 8.98 sec).
  Restored /home/vsts/work/1/s/src/Controls/Foldable/src/Controls.Foldable.csproj (in 586 ms).
  Restored /home/vsts/work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 43 ms).
  Restored /home/vsts/work/1/s/src/Essentials/src/Essentials.csproj (in 28 ms).
  Restored /home/vsts/work/1/s/src/Core/src/Core.csproj (in 79 ms).
  Restored /home/vsts/work/1/s/src/Core/maps/src/Maps.csproj (in 56 ms).
  Restored /home/vsts/work/1/s/src/Controls/Maps/src/Controls.Maps.csproj (in 890 ms).
  Restored /home/vsts/work/1/s/src/Controls/src/Xaml/Controls.Xaml.csproj (in 31 ms).
  Restored /home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj (in 581 ms).
  1 of 11 projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0-android36.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0-android36.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0-android36.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Maps -> /home/vsts/work/1/s/artifacts/bin/Maps/Debug/net10.0-android36.0/Microsoft.Maui.Maps.dll
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-android36.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Foldable.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-android36.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Xaml.dll
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Maps.dll
  Controls.TestCases.HostApp -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Controls.TestCases.HostApp.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Maps.dll
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Foldable.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Xaml.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Maps.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:09:32.60
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0
  Determining projects to restore...
  Restored /home/vsts/work/1/s/src/Controls/tests/CustomAttributes/Controls.CustomAttributes.csproj (in 1.47 sec).
  Restored /home/vsts/work/1/s/src/TestUtils/src/VisualTestUtils/VisualTestUtils.csproj (in 3 ms).
  Restored /home/vsts/work/1/s/src/TestUtils/src/VisualTestUtils.MagickNet/VisualTestUtils.MagickNet.csproj (in 7.41 sec).
  Restored /home/vsts/work/1/s/src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj (in 9.1 sec).
  Restored /home/vsts/work/1/s/src/TestUtils/src/UITest.Core/UITest.Core.csproj (in 2 ms).
  Restored /home/vsts/work/1/s/src/TestUtils/src/UITest.Appium/UITest.Appium.csproj (in 3 ms).
  Restored /home/vsts/work/1/s/src/TestUtils/src/UITest.NUnit/UITest.NUnit.csproj (in 1.31 sec).
  Restored /home/vsts/work/1/s/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj (in 3.83 sec).
  5 of 13 projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Controls.CustomAttributes -> /home/vsts/work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  UITest.Core -> /home/vsts/work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  VisualTestUtils -> /home/vsts/work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  UITest.NUnit -> /home/vsts/work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  VisualTestUtils.MagickNet -> /home/vsts/work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.Appium -> /home/vsts/work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  UITest.Analyzers -> /home/vsts/work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
  Controls.TestCases.Android.Tests -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/Controls.TestCases.Android.Tests.dll
Test run for /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/Controls.TestCases.Android.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (x64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.18]   Discovering: Controls.TestCases.Android.Tests
[xUnit.net 00:00:00.77]   Discovered:  Controls.TestCases.Android.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/Controls.TestCases.Android.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 06/11/2026 11:52:51 FixtureSetup for Issue35613(Android)
>>>>> 06/11/2026 11:53:06 The FixtureSetup threw an exception. Attempt 0/1.
Exception details: System.TimeoutException: OnNavigatingFrom with a NavigationPage always has an incorrect DestinationPage parameter
   at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2757
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2784
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 793
   at Microsoft.Maui.TestCases.Tests._IssuesUITest.NavigateToIssue(String issue) in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs:line 54
   at Microsoft.Maui.TestCases.Tests._IssuesUITest.TryToResetTestState() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs:line 25
   at Microsoft.Maui.TestCases.Tests.UITest.FixtureSetup() in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 576
>>>>> 06/11/2026 11:53:11 FixtureSetup for Issue35613(Android)
>>>>> 06/11/2026 11:53:29 The FixtureSetup threw an exception. Attempt 1/1.
Exception details: System.TimeoutException: OnNavigatingFrom with a NavigationPage always has an incorrect DestinationPage parameter
   at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2757
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2784
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 793
   at Microsoft.Maui.TestCases.Tests._IssuesUITest.NavigateToIssue(String issue) in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs:line 54
   at Microsoft.Maui.TestCases.Tests._IssuesUITest.TryToResetTestState() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs:line 25
   at Microsoft.Maui.TestCases.Tests.UITest.FixtureSetup() in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 576
>>>>> 06/11/2026 11:53:29 Log types: logcat, bugreport, server
>>>>> 06/11/2026 11:53:30 Log types: logcat, bugreport, server
  Failed VerifyNavigatingToAndNavigatingFromArgsForPopAndPopToRoot [1 m 29 s]
  Error Message:
   OneTimeSetUp: System.TimeoutException : OnNavigatingFrom with a NavigationPage always has an incorrect DestinationPage parameter
  Stack Trace:
     at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2757
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2784
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 793
   at Microsoft.Maui.TestCases.Tests._IssuesUITest.NavigateToIssue(String issue) in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs:line 54
   at Microsoft.Maui.TestCases.Tests._IssuesUITest.TryToResetTestState() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs:line 25
   at Microsoft.Maui.TestCases.Tests.UITest.FixtureSetup() in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 576
   at UITest.Appium.NUnit.UITestBase.OneTimeSetup() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 221
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Setup failed for test fixture Microsoft.Maui.TestCases.Tests.Issues.Issue35613(Android)
System.TimeoutException : OnNavigatingFrom with a NavigationPage always has an incorrect DestinationPage parameter
StackTrace:    at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2757
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2784
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 793
   at Microsoft.Maui.TestCases.Tests._IssuesUITest.NavigateToIssue(String issue) in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs:line 54
   at Microsoft.Maui.TestCases.Tests._IssuesUITest.TryToResetTestState() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs:line 25
   at Microsoft.Maui.TestCases.Tests.UITest.FixtureSetup() in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 576
   at UITest.Appium.NUnit.UITestBase.OneTimeSetup() in /_/src/TestUtils/src/UITest.NUnit/UITestBase.cs:line 221
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue35613.trx

Total tests: 1
Test Run Failed.
     Failed: 1
 Total time: 1.7514 Minutes
>>> TRX_RESULT_FILE: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue35613.trx

🟢 With fix — 🖥️ Issue35613: PASS ✅ · 1343s

(truncated to last 15,000 chars)

ontrols.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: --- End of stack trace from previous location --- [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at AndroidDeviceExtensions.PushAndInstallPackageAsync(AndroidDevice device, PushAndInstallCommand command, CancellationToken token) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at AndroidDeviceExtensions.PushAndInstallPackageAsync(AndroidDevice device, PushAndInstallCommand command, CancellationToken token) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.InstallPackage(Boolean installed) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.InstallPackage(Boolean installed) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.RunInstall() [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]

Build FAILED.

/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install output: cmd: Failure calling service package: Broken pipe (32) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:  [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass105_0.<InstallPackage>b__0(Task`1 t) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: --- End of stack trace from previous location --- [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010: --- End of stack trace from previous location --- [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at AndroidDeviceExtensions.PushAndInstallPackageAsync(AndroidDevice device, PushAndInstallCommand command, CancellationToken token) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at AndroidDeviceExtensions.PushAndInstallPackageAsync(AndroidDevice device, PushAndInstallCommand command, CancellationToken token) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.InstallPackage(Boolean installed) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.InstallPackage(Boolean installed) [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
/home/vsts/work/1/s/.dotnet/packs/Microsoft.Android.Sdk.Linux/36.1.2/tools/Xamarin.Android.Common.Debugging.targets(333,5): error ADB0010:    at Xamarin.Android.Tasks.FastDeploy.RunInstall() [/home/vsts/work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-android]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:10:52.50
* daemon not running; starting now at tcp:5037
* daemon started successfully
  Determining projects to restore...
  All projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0-android36.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0-android36.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0-android36.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Maps -> /home/vsts/work/1/s/artifacts/bin/Maps/Debug/net10.0-android36.0/Microsoft.Maui.Maps.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-android36.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-android36.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Xaml.dll
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Maps.dll
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-android36.0/Microsoft.Maui.Controls.Foldable.dll
  Controls.TestCases.HostApp -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Controls.TestCases.HostApp.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Maps.dll
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Controls.Maps -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Maps.dll
  Controls.Foldable -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Foldable.dll
  Controls.Xaml -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.Maui.Controls.Xaml.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-android/Microsoft.AspNetCore.Components.WebView.Maui.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:08:41.49
Broadcasting: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x400000 }
Broadcast completed: result=0
  Determining projects to restore...
  All projects are up-to-date for restore.
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Graphics -> /home/vsts/work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Essentials -> /home/vsts/work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Core -> /home/vsts/work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.CustomAttributes -> /home/vsts/work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  Controls.BindingSourceGen -> /home/vsts/work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.80-ci+azdo.14346766
  Controls.Core -> /home/vsts/work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  UITest.Core -> /home/vsts/work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  VisualTestUtils -> /home/vsts/work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  UITest.NUnit -> /home/vsts/work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  VisualTestUtils.MagickNet -> /home/vsts/work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.Appium -> /home/vsts/work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  UITest.Analyzers -> /home/vsts/work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
  Controls.TestCases.Android.Tests -> /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/Controls.TestCases.Android.Tests.dll
Test run for /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/Controls.TestCases.Android.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (x64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.12]   Discovering: Controls.TestCases.Android.Tests
[xUnit.net 00:00:00.39]   Discovered:  Controls.TestCases.Android.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/Controls.TestCases.Android.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 06/11/2026 12:15:47 FixtureSetup for Issue35613(Android)
>>>>> 06/11/2026 12:15:48 VerifyNavigatingToAndNavigatingFromArgsForPopAndPopToRoot Start
>>>>> 06/11/2026 12:15:58 VerifyNavigatingToAndNavigatingFromArgsForPopAndPopToRoot Stop
  Passed VerifyNavigatingToAndNavigatingFromArgsForPopAndPopToRoot [10 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue35613.trx

Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 27.7860 Seconds
>>> TRX_RESULT_FILE: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue35613.trx

📁 Fix files reverted (3 files)
  • eng/pipelines/ci-copilot.yml
  • src/Controls/src/Core/NavigationPage/NavigationPage.Legacy.cs
  • src/Controls/src/Core/NavigationPage/NavigationPage.cs

UI Tests

Full UI test matrix will run (no specific categories detected from PR changes).


Pre-Flight — Context & Validation

Issue: #35613 - OnNavigatingFrom with a NavigationPage always has an incorrect DestinationPage parameter
PR: #35733 - Fix incorrect DestinationPage in NavigationPage OnNavigatingFrom events
Platforms Affected: Android reported/verified; PR claims Android, Windows, iOS, Mac; code path is cross-platform NavigationPage handler + legacy renderer
Files Changed: 2 implementation, 2 test

Key Findings

  • Issue #35613 reports NavigatingFromEventArgs.DestinationPage is the source/current page during NavigationPage Push/Pop instead of the actual target page.
  • PR fix changes NavigationPage.SendNavigating to accept an explicit destination page and updates modern handler and legacy renderer Push/Pop/PopToRoot call sites.
  • Added UI regression coverage exercises Push, PopToRoot, and Pop through Issue35613 on the Navigation category.
  • PR discussion includes Android device-test trigger and a prior review request; no inline review comments were available from the public API.

Code Review Summary

Verdict: NEEDS_CHANGES
Confidence: medium
Errors: 0 | Warnings: 1 | Suggestions: 0

Key code review findings:

  • ⚠️ src/Controls/tests/TestCases.HostApp/Issues/Issue35613.cs:14 static test log is never cleared, so repeated HostApp scenarios could pass from stale Does.Contain(...) entries.

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #35733 Add explicit destinationPage parameter to SendNavigating and pass pushed/previous/root page from each NavigationPage call site. ✅ PASSED (Gate) NavigationPage.cs, NavigationPage.Legacy.cs, UI test files Original PR; product fix reviewed as sound, test has static log warning.

Code Review — Deep Analysis

Code Review — PR #35733

Independent Assessment

What this changes: NavigationPage now passes the actual destination page into NavigatingFromEventArgs for Push, Pop, and PopToRoot across legacy and handler navigation paths.
Inferred motivation: Fix OnNavigatingFrom reporting the current/source page as DestinationPage.

Reconciliation with PR Narrative

Author claims: Fixes #35613 by adding explicit destination plumbing and covers modern + legacy paths.
Agreement/disagreement: Agrees. The code matches the claimed root cause and approach.

Findings

⚠️ Warning — Static test log is never cleared

src/Controls/tests/TestCases.HostApp/Issues/Issue35613.cs:14

The issue page stores log entries in static state, but the constructor never calls ClearLog() before starting a new scenario. Since the Appium assertions use Does.Contain(...), rerunning this page/test in the same HostApp process could pass from stale entries. Clear the log before the initial PushAsync.

Devil's Advocate

The product-code fix is straightforward and consistent with NavigatedFrom semantics. CI check-runs for the head SHA are successful; the combined status is pending but no failing check-runs were found. I did not run device/UI tests locally.

Verdict: NEEDS_CHANGES

Confidence: medium
Summary: The NavigationPage fix looks sound, but the added regression test should clear its static log to avoid false positives on repeated runs. Inline findings were written to CustomAgentLogsTmp/PRState/35733/PRAgent/inline-findings.json.


Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 try-fix Derive destination inside SendNavigating from NavigationType and NavigationPage stack state; Push stages the page before firing OnNavigatingFrom. ✅ PASS 2 files Android regression passed, but Push stack/event ordering changes make it riskier than PR.
2 try-fix Dispatch OnNavigatingFrom from SendHandlerUpdateAsync after staging final stack; destination is final stack top. ✅ PASS 2 files Android regression passed, but central pipeline change is more invasive and changes timing.
PR PR #35733 Explicitly pass destinationPage into SendNavigating from each Push/Pop/PopToRoot call site. ✅ PASSED (Gate) 4 files Original PR; simplest product fix, preserves pre-stack-mutation dispatch ordering. Code review warning is limited to static state in added UI test.

Cross-Pollination

Model Round New Ideas? Details
maui-expert-reviewer 2 No NO NEW IDEAS: any sound fix must carry the intended destination across the async navigation boundary; alternatives reduce to explicit plumbing, stack inference, or final-stack snapshotting with extra ordering/parity risk.

Exhausted: Yes
Selected Fix: PR's fix — it is the least invasive passing approach and preserves existing navigation event ordering better than both passing alternatives.


Report — Final Recommendation

Comparative Report - PR #35733

Candidate Ranking

Rank Candidate Regression result Assessment
1 pr-plus-reviewer PASS by inheritance from PR gate; sandbox-only reviewer change not rerun Best candidate. Keeps the PR's explicit destination plumbing, which is the least invasive correct product fix, and adds the reviewer-requested ClearLog() call so the UI regression cannot pass from stale static log entries on repeated HostApp runs.
2 pr PASS - gate passed on Android; tests fail without fix and pass with fix Product fix is sound and lower risk than the alternatives because it preserves existing pre-stack-mutation navigation event ordering. Ranked below pr-plus-reviewer only because the added UI test can false-pass on stale static log state.
3 try-fix-1 PASS Derives destination from NavigationPage stack state. It passes the regression but changes Push stack/event ordering by staging the pushed page before OnNavigatingFrom, which is riskier than explicit destination plumbing.
4 try-fix-2 PASS Dispatches OnNavigatingFrom after final-stack staging through a widened central navigation pipeline. It passes the regression but is the most invasive passing approach and changes event timing semantics more broadly.

No candidate with a failed regression test outranks a passing candidate. All STEP 5a candidates passed the Android regression, so the ranking is based on correctness risk, invasiveness, event-order preservation, and test robustness.

Winner

pr-plus-reviewer wins. It preserves the PR's targeted product behavior while applying the only expert-reviewer actionable feedback: clearing the static UI-test log before starting the scenario. The try-fix candidates are valid but more invasive and introduce avoidable event-order/timing risk.

Notes

  • The product fix should remain explicit destination plumbing rather than destination inference from mutable navigation stack state.
  • The raw inline finding remains in CustomAgentLogsTmp/PRState/35733/PRAgent/inline-findings.json for the inline-comment posting step.
  • The sandbox candidate change was applied under /home/vsts/.copilot/session-state/340afd28-aadf-4481-89ff-09819ae8f506/files/pr-plus-reviewer/.

Future Action — review latest findings

No alternative fix was selected for this run. Review the session findings and CI results before merging.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Jun 11, 2026
@kubaflo
kubaflo changed the base branch from main to inflight/current June 11, 2026 19:22
@kubaflo
kubaflo merged commit 4ccd542 into dotnet:inflight/current Jun 11, 2026
32 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR9 milestone Jun 11, 2026
PureWeen pushed a commit that referenced this pull request Jun 22, 2026
…ts (#35733)

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

### Issue Details
In .NET MAUI, when navigating between pages using NavigationPage, the
OnNavigatingFrom event fires with the wrong destination page. For
example, navigating from Page A to Page B gives DestinationPage = A
instead of B.

### Root Cause
The method SendNavigating() inside NavigationPage was always using
CurrentPage (the page you're leaving) as the destination in the event.
At the time the event fires, CurrentPage hasn't changed yet — so the
destination always pointed to itself instead of the actual next page.

### Description of Change
Added a destinationPage parameter to SendNavigating() and updated all
call sites to pass the correct target page — the pushed page for Push,
the page below for Pop, and the root page for PopToRoot. This fix covers
both the modern handler path and the legacy renderer path.

Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #35613 

### Output  ScreenShot

iOS
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/8304a2f4-16be-471a-b1e3-d00381222a8d"
>| <video
src="https://github.com/user-attachments/assets/3299f0c1-c74d-4c8a-8d90-e3bedf214eb5">|


Android
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/dce2fae4-f788-49f3-9305-2390779771a2"
>| <video
src="https://github.com/user-attachments/assets/fcef7592-c747-4902-ae91-5b7da60c61d3">|
kubaflo pushed a commit that referenced this pull request Jun 25, 2026
…ts (#35733)

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

### Issue Details
In .NET MAUI, when navigating between pages using NavigationPage, the
OnNavigatingFrom event fires with the wrong destination page. For
example, navigating from Page A to Page B gives DestinationPage = A
instead of B.

### Root Cause
The method SendNavigating() inside NavigationPage was always using
CurrentPage (the page you're leaving) as the destination in the event.
At the time the event fires, CurrentPage hasn't changed yet — so the
destination always pointed to itself instead of the actual next page.

### Description of Change
Added a destinationPage parameter to SendNavigating() and updated all
call sites to pass the correct target page — the pushed page for Push,
the page below for Pop, and the root page for PopToRoot. This fix covers
both the modern handler path and the legacy renderer path.

Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #35613 

### Output  ScreenShot

iOS
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/8304a2f4-16be-471a-b1e3-d00381222a8d"
>| <video
src="https://github.com/user-attachments/assets/3299f0c1-c74d-4c8a-8d90-e3bedf214eb5">|


Android
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/dce2fae4-f788-49f3-9305-2390779771a2"
>| <video
src="https://github.com/user-attachments/assets/fcef7592-c747-4902-ae91-5b7da60c61d3">|
kubaflo pushed a commit that referenced this pull request Jul 3, 2026
…ts (#35733)

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

### Issue Details
In .NET MAUI, when navigating between pages using NavigationPage, the
OnNavigatingFrom event fires with the wrong destination page. For
example, navigating from Page A to Page B gives DestinationPage = A
instead of B.

### Root Cause
The method SendNavigating() inside NavigationPage was always using
CurrentPage (the page you're leaving) as the destination in the event.
At the time the event fires, CurrentPage hasn't changed yet — so the
destination always pointed to itself instead of the actual next page.

### Description of Change
Added a destinationPage parameter to SendNavigating() and updated all
call sites to pass the correct target page — the pushed page for Push,
the page below for Pop, and the root page for PopToRoot. This fix covers
both the modern handler path and the legacy renderer path.

Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #35613 

### Output  ScreenShot

iOS
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/8304a2f4-16be-471a-b1e3-d00381222a8d"
>| <video
src="https://github.com/user-attachments/assets/3299f0c1-c74d-4c8a-8d90-e3bedf214eb5">|


Android
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/dce2fae4-f788-49f3-9305-2390779771a2"
>| <video
src="https://github.com/user-attachments/assets/fcef7592-c747-4902-ae91-5b7da60c61d3">|
@kubaflo kubaflo mentioned this pull request Jul 6, 2026
kubaflo pushed a commit that referenced this pull request Jul 6, 2026
…ts (#35733)

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

### Issue Details
In .NET MAUI, when navigating between pages using NavigationPage, the
OnNavigatingFrom event fires with the wrong destination page. For
example, navigating from Page A to Page B gives DestinationPage = A
instead of B.

### Root Cause
The method SendNavigating() inside NavigationPage was always using
CurrentPage (the page you're leaving) as the destination in the event.
At the time the event fires, CurrentPage hasn't changed yet — so the
destination always pointed to itself instead of the actual next page.

### Description of Change
Added a destinationPage parameter to SendNavigating() and updated all
call sites to pass the correct target page — the pushed page for Push,
the page below for Pop, and the root page for PopToRoot. This fix covers
both the modern handler path and the legacy renderer path.

Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #35613 

### Output  ScreenShot

iOS
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/8304a2f4-16be-471a-b1e3-d00381222a8d"
>| <video
src="https://github.com/user-attachments/assets/3299f0c1-c74d-4c8a-8d90-e3bedf214eb5">|


Android
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/dce2fae4-f788-49f3-9305-2390779771a2"
>| <video
src="https://github.com/user-attachments/assets/fcef7592-c747-4902-ae91-5b7da60c61d3">|
PureWeen pushed a commit that referenced this pull request Jul 7, 2026
…ts (#35733)

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

### Issue Details
In .NET MAUI, when navigating between pages using NavigationPage, the
OnNavigatingFrom event fires with the wrong destination page. For
example, navigating from Page A to Page B gives DestinationPage = A
instead of B.

### Root Cause
The method SendNavigating() inside NavigationPage was always using
CurrentPage (the page you're leaving) as the destination in the event.
At the time the event fires, CurrentPage hasn't changed yet — so the
destination always pointed to itself instead of the actual next page.

### Description of Change
Added a destinationPage parameter to SendNavigating() and updated all
call sites to pass the correct target page — the pushed page for Push,
the page below for Pop, and the root page for PopToRoot. This fix covers
both the modern handler path and the legacy renderer path.

Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #35613 

### Output  ScreenShot

iOS
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/8304a2f4-16be-471a-b1e3-d00381222a8d"
>| <video
src="https://github.com/user-attachments/assets/3299f0c1-c74d-4c8a-8d90-e3bedf214eb5">|


Android
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/dce2fae4-f788-49f3-9305-2390779771a2"
>| <video
src="https://github.com/user-attachments/assets/fcef7592-c747-4902-ae91-5b7da60c61d3">|
PureWeen pushed a commit that referenced this pull request Jul 7, 2026
…ts (#35733)

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

### Issue Details
In .NET MAUI, when navigating between pages using NavigationPage, the
OnNavigatingFrom event fires with the wrong destination page. For
example, navigating from Page A to Page B gives DestinationPage = A
instead of B.

### Root Cause
The method SendNavigating() inside NavigationPage was always using
CurrentPage (the page you're leaving) as the destination in the event.
At the time the event fires, CurrentPage hasn't changed yet — so the
destination always pointed to itself instead of the actual next page.

### Description of Change
Added a destinationPage parameter to SendNavigating() and updated all
call sites to pass the correct target page — the pushed page for Push,
the page below for Pop, and the root page for PopToRoot. This fix covers
both the modern handler path and the legacy renderer path.

Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #35613 

### Output  ScreenShot

iOS
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/8304a2f4-16be-471a-b1e3-d00381222a8d"
>| <video
src="https://github.com/user-attachments/assets/3299f0c1-c74d-4c8a-8d90-e3bedf214eb5">|


Android
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/dce2fae4-f788-49f3-9305-2390779771a2"
>| <video
src="https://github.com/user-attachments/assets/fcef7592-c747-4902-ae91-5b7da60c61d3">|
kubaflo pushed a commit that referenced this pull request Jul 10, 2026
…ts (#35733)

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

### Issue Details
In .NET MAUI, when navigating between pages using NavigationPage, the
OnNavigatingFrom event fires with the wrong destination page. For
example, navigating from Page A to Page B gives DestinationPage = A
instead of B.

### Root Cause
The method SendNavigating() inside NavigationPage was always using
CurrentPage (the page you're leaving) as the destination in the event.
At the time the event fires, CurrentPage hasn't changed yet — so the
destination always pointed to itself instead of the actual next page.

### Description of Change
Added a destinationPage parameter to SendNavigating() and updated all
call sites to pass the correct target page — the pushed page for Push,
the page below for Pop, and the root page for PopToRoot. This fix covers
both the modern handler path and the legacy renderer path.

Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #35613 

### Output  ScreenShot

iOS
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/8304a2f4-16be-471a-b1e3-d00381222a8d"
>| <video
src="https://github.com/user-attachments/assets/3299f0c1-c74d-4c8a-8d90-e3bedf214eb5">|


Android
|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/dce2fae4-f788-49f3-9305-2390779771a2"
>| <video
src="https://github.com/user-attachments/assets/fcef7592-c747-4902-ae91-5b7da60c61d3">|
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 12, 2026
@github-actions github-actions Bot modified the milestones: .NET 10 SR9, .NET 10 SR10 Aug 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-navigation NavigationPage community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OnNavigatingFrom with a NavigationPage always has an incorrect DestinationPage parameter

5 participants