When application is started first time it works fine, however, after closing application and starting again it throws the below exception. I am using FFImageLoading.Compat for .NET MAUI and as per exception detail I am getting this exception due to FFImageLoading library.The exception occurs in base.OnCreate(_Bundle) in OnCreate method which is inside MainActivity.cs for Android. And crashes inside AppDelegate.cs in IOS.
at FFImageLoading.Maui.CachedImage.SetupOnBeforeImageLoading(TaskParameter& imageLoader, IImageSourceBinding source, IImageSourceBinding loadingPlaceholderSource, IImageSourceBinding errorPlaceholderSource)
at FFImageLoading.Maui.Platform.CachedImageHandler.UpdateBitmap(CachedImageView imageView, CachedImage image, CachedImage previousImage)
at FFImageLoading.Maui.Platform.CachedImageHandler.ConnectHandler(CachedImageView platformView)
at Microsoft.Maui.Handlers.ViewHandler`2[[FFImageLoading.Maui.CachedImage, FFImageLoading.Compat.Maui, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null],[FFImageLoading.Maui.Platform.CachedImageView, FFImageLoading.Compat.Maui, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null]].OnConnectHandler(View platformView) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 76
at Microsoft.Maui.Handlers.ViewHandler.OnConnectHandler(Object platformView) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:line 151
at Microsoft.Maui.Handlers.ElementHandler.ConnectHandler(Object platformView) in D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 106
at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 64
at Microsoft.Maui.Handlers.ViewHandler.SetVirtualView(IElement element) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:line 134
at Microsoft.Maui.Handlers.ViewHandler`2[[FFImageLoading.Maui.CachedImage, FFImageLoading.Compat.Maui, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null],[FFImageLoading.Maui.Platform.CachedImageView, FFImageLoading.Compat.Maui, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 53
at Microsoft.Maui.Handlers.ViewHandler`2[[FFImageLoading.Maui.CachedImage, FFImageLoading.Compat.Maui, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null],[FFImageLoading.Maui.Platform.CachedImageView, FFImageLoading.Compat.Maui, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56
at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 69
at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 19
at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:line 305
at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96
I am unable to find the exact reason of why I am getting this exception only when it starts second time and works fine when started first time. Because of this issue I had to uninstall application after just using it for the first time and reinstall if I had to use application again.