-
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
NullReferenceException when setting BarBackgroundColor for a NavigationPage #25114
Comments
this NavigationPageToolbar class was changed a few weeks ago and the OnPagePropertyChanged method was modified - this is likely where the issue is coming from - check commit fa9e370 the original OnPropertyChanged method was removed the OnPagePropertyChanged method was changed to include most of the code that was removed from the other method this is clearly doing things slightly differently, which is breaking things. |
the offending PR seems to be this one |
We've also hit what I believe to be the same issue. I can confirm that this also happens on both iOS and Android, and that it is a regression introduced in 8.0.90. I have made a small reproduction, here, which demonstrates the issue When running this project, the app will crash on launch. The expected behaviour, and the behaviour observed on previous MAUI releases, is that no crash occurs, and the color is correctly updated. Our production application exhibiting this issue is more complex than the reproduction sample, and makes heavy use of dynamic resources for colors. The impact there is that the main section of our app is inaccessible, on Android the app hangs completely, on iOS it hangs, but will crash after user interaction with this same stack trace. I'm not currently aware of any viable workaround, so it's a pressing issue for us. Thanks for your consideration. cc @MitchBomcanhao @samhouts |
@kubaflo This seems related to some changes you made recently. Would you like to take a look? Thank you!!! |
@samhouts @markmccaigue @MitchBomcanhao the fix: #25197 |
Description
From 8.0.90 (as far as I can tell) I get NRE when attempting to set a NavigationPage's BarBackgroundColor.
I'm not sure of how this is failing (ie I can't share a repro project at the moment), but it can't hurt to get the ball rolling on this topic, perhaps others have had similar issues?
this is running on a
Flyout
page - its detail is set to a navigation page that encapsulates a content page.when the content page triggers
OnAppearing
we set the BarBackgroundColor for the navigation page.however, when it gets to the
NavigationPageToolbar.ApplyChanges
method, it blows up, as it seemingly receives a null navigationPage objectand that null object comes from the call from
NavigationPageToolbar.OnPagePropertyChanged
Microsoft.Maui.Controls.dll!Microsoft.Maui.Controls.NavigationPageToolbar.ApplyChanges(Microsoft.Maui.Controls.NavigationPage navigationPage) Unknown
Microsoft.Maui.Controls.dll!Microsoft.Maui.Controls.NavigationPageToolbar.OnPagePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) Unknown
Microsoft.Maui.Controls.dll!Microsoft.Maui.Controls.MenuItemTracker<System.__Canon>.OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs propertyChangedEventArgs) Unknown
Microsoft.Maui.Controls.dll!Microsoft.Maui.Controls.BindableObject.OnPropertyChanged(string propertyName) Unknown
Microsoft.Maui.Controls.dll!Microsoft.Maui.Controls.Element.OnPropertyChanged(string propertyName) Unknown
Microsoft.Maui.Controls.dll!Microsoft.Maui.Controls.BindableObject.SetValueActual(Microsoft.Maui.Controls.BindableProperty property, Microsoft.Maui.Controls.BindableObject.BindablePropertyContext context, object value, bool currentlyApplying, Microsoft.Maui.Controls.Internals.SetValueFlags attributes, Microsoft.Maui.Controls.SetterSpecificity specificity, bool silent) Unknown
Microsoft.Maui.Controls.dll!Microsoft.Maui.Controls.BindableObject.SetValueCore(Microsoft.Maui.Controls.BindableProperty property, object value, Microsoft.Maui.Controls.Internals.SetValueFlags attributes, Microsoft.Maui.Controls.BindableObject.SetValuePrivateFlags privateAttributes, Microsoft.Maui.Controls.SetterSpecificity specificity) Unknown
Microsoft.Maui.Controls.dll!Microsoft.Maui.Controls.BindableObject.SetValue(Microsoft.Maui.Controls.BindableProperty property, object value) Unknown
Microsoft.Maui.Controls.dll!Microsoft.Maui.Controls.NavigationPage.BarBackgroundColor.set(Microsoft.Maui.Graphics.Color value) Unknown
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.91 SR9.1
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.82 SR8.2
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: