This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.
[CollectionView, Android] DisposedObjectException thrown when adding elements to ItemsSource after having disposed CollectionView containing EmptyView #6427
Closed
Description
Description
Adding elements to the ItemsSource of a CollectionView, that has EmptyView set, throws an exception. This exception cannot be caught calling the Add() function inside a try-catch. A workaround is not to set the EmptyView.
Steps to Reproduce
- Create a new Xamarin.Forms project
- Create a page containing a CollectionView that has ItemsSource and EmptyView set
- Open and close the page with Navigation.PushAsync() and .PopAsync()
- Add an element to the ItemsSource collection
Expected Behavior
Element is added
Actual Behavior
An ObjectDisposedException is thrown:
Unhandled Exception:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Xamarin.Forms.Platform.Android.CollectionViewRenderer'.
=================================================================
Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
=================================================================
Basic Fault Adddress Reporting
=================================================================
space (region space) (deleted)Memory around native instruction pointer (0x78e3800678):
0x78e3800668 00 1c 40 b9 c0 03 5f d6 fd 7b bf a9 fd 03 00 91 ..@..._..{......
0x78e3800678 08 20 40 b9 a8 00 c8 37 88 01 e0 37 00 00 40 f9 . @....7...7..@.
0x78e3800688 fd 7b c1 a8 c0 03 5f d6 60 08 00 b0 01 0a 00 f0 .{...._.`.......
0x78e3800698 03 0a 00 f0 00 24 06 91 21 80 08 91 63 8c 0a 91 .....$..!...c...
No native Android stacktrace (see debuggerd output).
=================================================================
Managed Stacktrace:
=================================================================
at <unknown> <0xffffffff>
at Java.Interop.NativeMethods:java_interop_jnienv_call_nonvirtual_void_method_a <0x00007>
at InstanceMethods:CallNonvirtualVoidMethod <0x0031b>
at JniInstanceMethods:InvokeNonvirtualVoidMethod <0x0016b>
at Adapter:NotifyItemInserted <0x0017f>
at Xamarin.Forms.Platform.Android.ObservableItemsSource:Add <0x0026f>
at Xamarin.Forms.Platform.Android.ObservableItemsSource:CollectionChanged <0x000d7>
at System.Collections.ObjectModel.ObservableCollection`1:OnCollectionChanged <0x00103>
at System.Collections.ObjectModel.ObservableCollection`1:OnCollectionChanged <0x000cb>
at System.Collections.ObjectModel.ObservableCollection`1:InsertItem <0x000d3>
at System.Collections.ObjectModel.Collection`1:Add <0x00183>
at <AddDeviceAsync>d__25:MoveNext <0x005db>
at MoveNextRunner:InvokeMoveNext <0x000f3>
at System.Threading.ExecutionContext:RunInternal <0x0040f>
at System.Threading.ExecutionContext:Run <0x0006b>
at MoveNextRunner:Run <0x00187>
at System.Threading.Tasks.AwaitTaskContinuation:InvokeAction <0x00097>
at System.Threading.Tasks.AwaitTaskContinuation:RunCallback <0x0010b>
at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run <0x000fb>
at System.Threading.Tasks.Task:FinishContinuations <0x005f7>
at System.Threading.Tasks.Task:FinishStageThree <0x00173>
at System.Threading.Tasks.Task`1:TrySetResult <0x00213>
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult <0x0021f>
at <GetDeviceAsync>d__11:MoveNext <0x00a37>
at MoveNextRunner:InvokeMoveNext <0x000f3>
at System.Threading.ExecutionContext:RunInternal <0x0040f>
at System.Threading.ExecutionContext:Run <0x0006b>
at MoveNextRunner:Run <0x00187>
at <>c:<.cctor>b__7_0 <0x0009b>
at <>c__DisplayClass2_0:<Post>b__0 <0x00093>
at RunnableImplementor:Run <0x000bb>
at Java.Lang.IRunnableInvoker:n_Run <0x000c3>
at Android.Runtime.DynamicMethodNameCounter:37 <0x0001f>
at Android.Runtime.DynamicMethodNameCounter:37 <0x000c7>
=================================================================
Basic Information
- Version with issue: 4.0.0.394984-pre10
- Last known good version: N/A
- IDE: Visual Studio 2019 (16.1.1)
- Platform Target Frameworks:
- Android: 8.1
- Android Support Library Version: 28.0.0.1
- Affected Devices: Android 8.1