Skip to content
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

NullPointer from SearchHandlerAppearanceTracker on iOS #19504

Closed
Larhei opened this issue Dec 19, 2023 · 2 comments · Fixed by #24970
Closed

NullPointer from SearchHandlerAppearanceTracker on iOS #19504

Larhei opened this issue Dec 19, 2023 · 2 comments · Fixed by #24970
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout platform/iOS 🍎 t/bug Something isn't working
Milestone

Comments

@Larhei
Copy link

Larhei commented Dec 19, 2023

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

@PureWeen
Copy link
Member

Related to #14442

@PureWeen PureWeen added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Dec 19, 2023
@PureWeen PureWeen added this to the Backlog milestone Dec 19, 2023
@ghost
Copy link

ghost commented Dec 19, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants