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

Try/Catch Needed in DisconnectImpl() #10

Open
bsloehr opened this issue Apr 23, 2024 · 0 comments
Open

Try/Catch Needed in DisconnectImpl() #10

bsloehr opened this issue Apr 23, 2024 · 0 comments

Comments

@bsloehr
Copy link

bsloehr commented Apr 23, 2024

Needed to add a try/catch around certain calls within DisconnectImpl(). The offending culprit in this case is the SyncFusion ListView control. The exception shows a NullReferenceException happening deep in their code. I'll report this to SyncFusion as well.

04-22 18:43:17.661 [-DBG-1] TrySafe:Exception in DisconnectImpl (Disconnect Handler Syncfusion.Maui.ListView.ListViewEmptyViewItem): System.NullReferenceException: Object reference not set to an instance of an object.
   at Syncfusion.Maui.ListView.ListViewItemExtensions.WireEvents(ListViewItem listViewItem)
   at Syncfusion.Maui.ListView.ListViewItem.OnHandlerChanged()
   at Microsoft.Maui.Controls.VisualElement.OnHandlerChangedCore()
   at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler)
   at Microsoft.Maui.Handlers.ElementHandler.DisconnectHandler(Object platformView)
   at Microsoft.Maui.Handlers.ElementHandler.Microsoft.Maui.IElementHandler.DisconnectHandler()
   at Mobile.Framework.NavigatorUtilities.<>c__DisplayClass0_0.<Disconnect>b__7()
   at Mobile.Framework.NavigatorUtilities.<Disconnect>g__TrySafely|0_0(Action action, String msg) 
        void TrySafely(Action action, string? msg = null)
        {
            try { action.Invoke();} catch (Exception e)
            {
                Serilog.Log.Logger.Verbose($"TrySafe:Exception in DisconnectImpl ({msg}): {e}");
            }
        }
TrySafely(() => { visualElement.Handler?.DisconnectHandler(); }, $"Disconnect Handler {visualElement}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant