-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows] Fix crash when navigating pages #25740
Conversation
{ | ||
HorizontalAlignment = UI.Xaml.HorizontalAlignment.Stretch, | ||
VerticalAlignment = UI.Xaml.VerticalAlignment.Stretch | ||
}; | ||
|
||
// It's possible that the unloaded event didn't happen yet, so force clear the content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: we don't just run this by default because when the transition is animated the page flashes blank.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also clear/set to null _previousContent
on Disconnect ?
There are similar issues on the Android platform #18331. |
/backport to release/9.0.1xx |
Started backporting to release/9.0.1xx: https://github.com/dotnet/maui/actions/runs/11920307270 |
Description of Change
Fixes a long-standing crash when navigating pages:
ContentPresenter.Content
property.When navigating pages it was discovered that the
Content
property of theContentPresenter
sometimes was not being detached from the parentContentPresenter
(theContentPresenter
itself does detach from the Page). A workaround for this was to manually clear theContent
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 yourAppShell
:Issues Fixed
Fixes #22790 #18441 #22131