Conversation
### Description of Change
Fixes a long-standing crash when navigating pages:
1. Manually clear the `ContentPresenter.Content` property.
When navigating pages it was discovered that the `Content` property of
the `ContentPresenter` sometimes was not being detached from the parent
`ContentPresenter` (the `ContentPresenter` itself does detach from the
Page). A workaround for this was to manually clear the `Content`
property.
**The actual cause of this bug:** I suspect that something causing the
lifecycle tracking to be messed up. I'm still not sure what this is, but
for now this will help our customers more than nothing.
## Workaround
The following can be used as a workaround. Place it in the `Loaded`
event for your `AppShell`:
```csharp
private void AppShell_Loaded(object? sender, EventArgs e)
{
Loaded -= AppShell_Loaded;
#if WINDOWS
if (Handler != null && Handler.PlatformView is ShellView shellView &&
shellView.Content is MauiNavigationView nv &&
nv.Content is Microsoft.UI.Xaml.Controls.Frame frame)
{
frame.Navigating += (s, e) =>
{
if (frame.Content is Microsoft.UI.Xaml.Controls.Page page)
{
page.Unloaded += PageUnloaded;
void PageUnloaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
page.Unloaded -= PageUnloaded;
if (page.Content is Microsoft.UI.Xaml.Controls.ContentPresenter presenter)
{
presenter.Content = null;
}
};
}
};
}
#endif
}
```
### Issues Fixed
Fixes #22790 #18441 #22131
undefined
* Changes in randomly failing UITests * Updated snapshots
don't get the property on the array type but on the element type - fixes #25819
* Fix signing fonts * update public yaml * Add _RunAsPublic * With rename * again * again * again * Comment * Dont validate sigining * Try again
* Add maui-template-steps * fix naming * Try to provision on devdiv try fix Try provision on devdiv More provision Do provisioning on devdiv try again fix Try with secrets * Try centralize demands * fix demands * fix * Fix pool * Use a global variable * try again * teste * try * this works * Try again * use for templates * Try more variable for provisionator * See if it works like this on xamarin * Add condition for mactemplates * Fix provisioning device tests * Fix pool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Bring latest changes from main to net9.0