Repository navigation
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 40101Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 40101" |
This comment has been minimized.
This comment has been minimized.
|
Hey there @@MykhailoDav! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Hey there @MykhailoDav! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| await shell.GoToAsync("Page5"); | ||
| Assert.Equal(3, page3Section.Stack.Count); | ||
|
|
||
| await shell.GoToAsync("//../Page2"); |
There was a problem hiding this comment.
[moderate] Regression Prevention and Test Coverage - Both added tests switch to a different section, leaving the new same-section exclusion untested. With the same Page3 -> Page4 -> Page5 fixture, navigate to `(redacted) and assert that Page4 remains the current page and the stack retains it. The destination stack is rebuilt before the new removal loop; removing its section-identity guard would therefore remove the retained Page4 while both added tests still succeed. Add this negative case so the tests distinguish popping the departed section from deleting the rebuilt destination.
PR Test Gate
🧪 Gate analysis — click to expand✅ Passed. The selected verification satisfied the gate's passing conditions. Unmatched, skipped, or inconclusive groups are not passing evidence. 🧪 Unit tests
Execution log excerptsWithout fix With fix PR head: 2368bd39. Without-fix baseline: c7e8239c. |
b082718
into
dotnet:candidate/11.0.1xx-sr2
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes #15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
### Description of Change
When an absolute Shell route is prefixed with `..` segments — e.g.
`GoToAsync("//../../Page2")` while two registered-route pages are pushed
on the current tab — the `..` segments are silently lost.
`ShellUriHandler.FormatUri` only handles `..` on fully relative routes,
so for `//`-prefixed routes the dots reach `ConvertToStandardFormat`,
where standard `Uri` dot-segment normalization deletes them. The request
degrades to a plain `//Page2` tab switch and the pages stay on the
previous tab's navigation stack, so re-selecting that tab shows the old
detail page instead of its root.
Because the navigation target is a different `ShellSection`, the pop
cannot be expressed in the rewritten URI (stack diffing only applies to
the target section) — the pages have to be removed from the section
being navigated away from.
**Fix**
Capture the number of leading `..` segments before the request is
resolved (`ShellUriHandler.CountLeadingDotDotSegments`) and, once the
navigation is accepted and the shell element switch has completed,
remove one page per `..` from the top of the previous section's stack —
the same `RemovePage` pattern the modal cleanup in
`ShellNavigationManager.GoToAsync` already uses. The removal is clamped
at the section root, runs only when the section actually changed
(same-section absolute routes already reset their stack), and never runs
when navigation is cancelled or deferred.
**Tests**
Added to `ShellNavigatingTests` using the issue's exact scenario (tabs
Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).
| | Without fix | With fix |
| --- | --- | --- |
| `GoToAsync("//../../Page2")` | Switches to Page2; Page4 and Page5
remain on Page3's stack | Switches to Page2; Page3's stack back to its
root |
| `GoToAsync("//../Page2")` | Switches to Page2; both pages remain |
Switches to Page2; only Page5 popped |
| Existing Shell suites | — | 566/566 pass; full Core.UnitTests has no
new failures |
### Issues Fixed
Fixes dotnet#15166
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
Description of Change
When an absolute Shell route is prefixed with
..segments — e.g.GoToAsync("//../../Page2")while two registered-route pages are pushed on the current tab — the..segments are silently lost.ShellUriHandler.FormatUrionly handles..on fully relative routes, so for//-prefixed routes the dots reachConvertToStandardFormat, where standardUridot-segment normalization deletes them. The request degrades to a plain//Page2tab switch and the pages stay on the previous tab's navigation stack, so re-selecting that tab shows the old detail page instead of its root.Because the navigation target is a different
ShellSection, the pop cannot be expressed in the rewritten URI (stack diffing only applies to the target section) — the pages have to be removed from the section being navigated away from.Fix
Capture the number of leading
..segments before the request is resolved (ShellUriHandler.CountLeadingDotDotSegments) and, once the navigation is accepted and the shell element switch has completed, remove one page per..from the top of the previous section's stack — the sameRemovePagepattern the modal cleanup inShellNavigationManager.GoToAsyncalready uses. The removal is clamped at the section root, runs only when the section actually changed (same-section absolute routes already reset their stack), and never runs when navigation is cancelled or deferred.Tests
Added to
ShellNavigatingTestsusing the issue's exact scenario (tabs Page1/Page2/Page3, registered routes Page4/Page5 pushed on Page3's tab).GoToAsync("//../../Page2")GoToAsync("//../Page2")Issues Fixed
Fixes #15166