- Home
- Forum
- Xamarin.Forms
- SfListView throws ObjectDisposedException when hidden during ItemTapped
SfListView throws ObjectDisposedException when hidden during ItemTapped
Update: I have also posted this as an incident
We have encountered an issue with SfListView on Android.
In our code, we use the ItemTapped event and during this event perform custom navigation to a different control, which causes the SfListView to be removed from its parent layout. This, in turn, causes an ObjectDisposedException:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Syncfusion.ListView.XForms.Android.ListViewItemRenderer'.
I have worked around the issue for now by using await Task.Delay(100); which apparently lets the control's renderer do the thing it has to do before it is removed, but it is clearly not an ideal solution and is clearly quite fragile. The same issue occurs when TappedCommand is used instead.
I have uploaded a simple repo demonstrating the problem to my GitHub and also attached a copy of the solution with this post.
Sample code
{
//await Task.Delay(100); <-- this dirty hack works around the problem
}
Attachment: SfListViewTapProblem_9e8b7307.zip
For Windows:
Follow the below link to clear cache,
https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache
For Mac:
Can you please check and remove in your mac if there is any package in the following location?
• ~/.local/share/NuGet/Cache
• ~/.nuget/package
- 3 Replies
- 4 Participants
-
MZ Martin Zikmund
- May 16, 2018 04:21 PM UTC
- Oct 11, 2018 12:07 PM UTC