NullPointer from SearchHandlerAppearanceTracker on iOS #19504
Labels
area-controls-shell
Shell Navigation, Routes, Tabs, Flyout
platform/iOS 🍎
t/bug
Something isn't working
Milestone
Description
Im getting a null pointer on iOS when navigating back to a page containing a Shell.Searchhandler.
CallStack is
Unhandled managed exception: Object reference not set to an instance of an object. (System.NullReferenceException) at Microsoft.Maui.Platform.ColorExtensions.ToPlatform(Color color) at Microsoft.Maui.Controls.Platform.Compatibility.SearchHandlerAppearanceTracker.UpdateClearPlaceholderIconColor(Color targetColor) at Microsoft.Maui.Controls.Platform.Compatibility.SearchHandlerAppearanceTracker.UpdateTextColor(UITextField textField) at Microsoft.Maui.Controls.Platform.Compatibility.SearchHandlerAppearanceTracker.UpdateSearchBarColors() at Microsoft.Maui.Controls.Platform.Compatibility.ShellPageRendererTracker.SetAppeared() at Microsoft.Maui.Controls.Platform.Compatibility.ShellPageRendererTracker.PageAppearing(Object sender, EventArgs e) at Microsoft.Maui.Controls.Page.SendAppearing() at Microsoft.Maui.Controls.Shell.SendPageAppearing(Page page) at Microsoft.Maui.Controls.ShellContent.SendPageAppearing(Page page) at Microsoft.Maui.Controls.ShellContent.SendAppearing() at Microsoft.Maui.Controls.ShellSection.PresentedPageAppearing() at Microsoft.Maui.Controls.ShellSection.OnPopAsync(Boolean animated)
Well I guess this is the reason for the error
Line
It should be
uiButton.TintColor = targetColor?.ToPlatform() ?? _defaultPlaceholderTintColor;
Also there is an other interesting code segments.
Here
In short. All calls to ToPlatform() for color should be xxx?.ToPlatform() in case there is no null check ;-)
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS
Did you find any workaround?
No
Relevant log output
No response
The text was updated successfully, but these errors were encountered: