Open kklose23 opened 1 year ago
I'm facing the same problem
After debugging it. The Nullpointer is because the maui context is null.
ViewExtensions
FindMauiContext is returning null in this
line
Did somebody have a chance to make the workaround without the search handler removal?
@devhls I wrote a workaround in the "Did you find any workaround?" section
@devhls Did the workaround work for you? I've tried and I still have this issue on iOS cc @kklose23
@Zangl Yes, I use this workaround with some details:
x:Name="MySearchHandler"
public MyPage()
{
InitializeComponent();
MySearchHandler.ClearIcon.Parent = this;
MySearchHandler.QueryIcon.Parent = this;
}
If I remember right The app works without exceptions, but I use default icons. I am not sure if this helps to use custom icons.
Description
Null reference exception when opening app within IOS that has a Shell search with an icon set within its search handler
Steps to Reproduce
AnimalSearchHandler
and setClearIcon = "clear_icon.png";
within the constructorLink to public reproduction project repository
N/A
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 16.2
Did you find any workaround?
Yes,
After setting
ClearIcon = "clear_icon.png";
, setClearIcon.Parent = Application.Current.MainPage;
This is because
source.FindMauiContext()
inShellPageRendererTracker.SetSearchBarIcon
was returning null. So setting a parent element on the icon fixes it.Relevant log output