-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
area-controls-shellShell Navigation, Routes, Tabs, FlyoutShell Navigation, Routes, Tabs, Flyoutpartner/syncfusionIssues / PR's with Syncfusion collaborationIssues / PR's with Syncfusion collaborationplatform/iost/bugSomething isn't workingSomething isn't working
Milestone
Description
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
- Follow these steps https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/shell/search?view=net-maui-7.0
- Create a constructor for the
AnimalSearchHandlerand setClearIcon = "clear_icon.png";within the constructor - Run the application in an IOS simulator
Link 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";, set ClearIcon.Parent = Application.Current.MainPage;
This is because source.FindMauiContext() in ShellPageRendererTracker.SetSearchBarIcon was returning null. So setting a parent element on the icon fixes it.
Relevant log output
at Microsoft.Maui.ImageSourceExtensions.GetPlatformImageAsync(IImageSource imageSource, IMauiContext mauiContext)
at Microsoft.Maui.ImageSourceExtensions.LoadImage(IImageSource source, IMauiContext mauiContext, Action`1 finished)
at Microsoft.Maui.Controls.Platform.Compatibility.ShellPageRendererTracker.SetSearchBarIcon(UISearchBar searchBar, ImageSource source, UISearchBarIcon icon)
at Microsoft.Maui.Controls.Platform.Compatibility.ShellPageRendererTracker.AttachSearchController()
at Microsoft.Maui.Controls.Platform.Compatibility.ShellPageRendererTracker.set_SearchHandler(SearchHandler value)
at Microsoft.Maui.Controls.Platform.Compatibility.ShellPageRendererTracker.UpdateShellToMyPage()
at Microsoft.Maui.Controls.Platform.Compatibility.ShellPageRendererTracker.OnPageSet(Page oldPage, Page newPage)
at Microsoft.Maui.Controls.Platform.Compatibility.ShellPageRendererTracker.set_Page(Page value)
at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad()
at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)gkarabinisax5 and devhls
Metadata
Metadata
Assignees
Labels
area-controls-shellShell Navigation, Routes, Tabs, FlyoutShell Navigation, Routes, Tabs, Flyoutpartner/syncfusionIssues / PR's with Syncfusion collaborationIssues / PR's with Syncfusion collaborationplatform/iost/bugSomething isn't workingSomething isn't working