xamarin/Xamarin.Forms
iOS: System.ObjectDisposedException when ListView bound ObservableCollection is changed
开放
#4,186 创建于 2018年10月23日
3.3.0a/listviewhas-stacktracehelp wantedi/highi/regressionp/iOS 🍎t/bug :bug:up-for-grabs
仓库指标
- 星标
- (5,644 个星标)
- PR 合并指标
- (30 天内没有已合并 PR)
描述
Description
when an observable collection, which is bound to a listview is changed (new created with 'new'), the app crashes. this only happens in the ios-app, the android-app is working with no problems.
Steps to Reproduce
i tried to create a minimal project to reproduce the behaviour, but it does not occur. even in our project, the crash is not reproducible all the time. but when it occurs, the stack trace is only in Xamarin.Forms and is always the same:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'CellTableViewCell'.
2018-10-23 19:54:27.889451+0200 xxx.iOS[1662:17051]
Unhandled Exception:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'CellTableViewCell'.
at Foundation.NSObject.get_SuperHandle () [0x00012] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:449
at UIKit.UITableViewCell.get_TextLabel () [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UITableViewCell.g.cs:976
at Xamarin.Forms.Platform.iOS.TextCellRenderer.HandleCellPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x0002a] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Cells\TextCellRenderer.cs:48
at Xamarin.Forms.Platform.iOS.CellTableViewCell.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Cells\CellTableViewCell.cs:44
at Xamarin.Forms.BindableObject.OnPropertyChange
d (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:150
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:370
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:623
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:417
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System
.Boolean fromTarget) [0x00225] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:173
at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78
at Xamarin.Forms.Binding.Apply (System.Object context, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:130
at Xamarin.Forms.BindableObject.ApplyBindings (System.Boolean skipBindingContext, System.Boolean fromBindingContextChanged) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:448
at Xamarin.Forms.BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x00007] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:467
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableP
roperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:625
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:417
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0003d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:573
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:99
at Xamarin.Forms.BindableObject.set_BindingContext (System.Objec
t value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:25
at Xamarin.Forms.Internals.TemplatedItemsList`2+<UnhookItem>d__154[TView,TItem].MoveNext () [0x000a5] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:1207
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/Foundation/NSAction.cs:178
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.Int
Ptr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:63
at xxx.iOS.Application.Main (System.String[] args) [0x00001] in xxx.iOS\Main.cs:12
2018-10-23 19:54:27.892064+0200 xxx.iOS[1662:17051] Unhandled managed exception:
Cannot access a disposed object.
Object name: 'CellTableViewCell'. (System.ObjectDisposedException)
at Foundation.NSObject.get_SuperHandle () [0x00012] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/Foundation/NSObject2.cs:449
at UIKit.UITableViewCell.get_TextLabel () [0x0002a] in /Libr
ary/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UITableViewCell.g.cs:976
at Xamarin.Forms.Platform.iOS.TextCellRenderer.HandleCellPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x0002a] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Cells\TextCellRenderer.cs:48
at Xamarin.Forms.Platform.iOS.CellTableViewCell.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Cells\CellTableViewCell.cs:44
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:150
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:370
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean
currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00114] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:623
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:417
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00225] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:173
at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78
at Xamarin.Forms.Binding.Apply (System.Object context, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.Bi
ndableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:130
at Xamarin.Forms.BindableObject.ApplyBindings (System.Boolean skipBindingContext, System.Boolean fromBindingContextChanged) [0x0003c] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:448
at Xamarin.Forms.BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x00007] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:467
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:625
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueF
lags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:417
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0003d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:573
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:99
at Xamarin.Forms.BindableObject.set_BindingContext (System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:25
at Xamarin.Forms.Internals.TemplatedItemsList`2+<UnhookItem>d__154[TView,TItem].MoveNext () [0x000a5] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:1207
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state
) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/Foundation/NSAction.cs:178
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:63
at xxx.iOS.Application.Main (System.String[] args) [0x00001] in xxx.iOS\Main.cs:12
2018-10-23 19:54:27.893018+0200 xxx.iOS[1662:17051] critical: Stacktrace:
2018-10-23 19:54:27.893300+0200 xxx.iOS[1662:17051] critical:
Native stacktrace:
2018-10-23 19:54:27.919750+0200 xxx.iOS[1662:17051] critical: 0 xxx.iOS 0x0000000104780504 mono_handle_native_crash + 244
2018-10-23 19:54:27.920109+0200 xxx.iOS[1662:17051] critical: 1 libsystem_platform.dylib 0x00000001145b7f5a _sigtramp + 26
2018-10-23 19:54:27.920369+0200 xxx.iOS[1662:17051] critical: 2 libsystem_pthread.dylib 0x00000001145c6570 libsystem_pthread.dylib + 1392
2018-10-23 19:54:27.920613+0200 xxx.iOS[1662:17051] critical: 3 libsystem_c.dylib 0x000000011433fc45 abort + 127
2018-10-23 19:54:27.920880+0200 xxx.iOS[1662:17051] critical: 4 xxx.iOS 0x000000010499d6af xamarin_unhandled_exception_handler + 47
2018-10-23 19:54:27.921197+0200 xxx.iOS[1662:17051] critical: 5 xxx.iOS 0x000000010481dece mono_invoke_unhandled_exception_hook + 158
2018-10-23 19:54:27.921474+0200 xxx.iOS[1662:17051] critical: 6 xxx.iOS 0x000000010477feb8 mono_handle_exception_internal + 5976
2018-10-23 19:54:27.921744+0200 xxx.iOS[1662:17051] critical: 7 xxx.iOS 0x000000010477e759 mono_handle_exception + 25
2018-10-23 19:54:27.922012+0200 xxx.iOS[1662:17051] critical: 8 xxx.iOS 0x00000001046fe473 mono_amd64_throw_exception + 131
2018-10-23 19:54:27.922322+0200 xxx.iOS[1662:17051] critical: 9 ??? 0x00000001335155a7 0x0 + 5155935655
2018-10-23 19:54:27.922612+0200 xxx.iOS[1662:17051] critical: 10 xxx.iOS 0x000000010463845c _ZL31native_to_managed_trampoline_20P11objc_objectP13objc_selectorPP11_MonoMethodj + 284
2018-10-23 19:54:27.922877+0200 xxx.iOS[1662:17051] critical: 11 xxx.iOS 0x000000010463ca04 -[__MonoMac_NSAsyncSynchronizationContextDispatcher xamarinApplySelector] + 52
2018-10-23 19:54:27.923350+0200 xxx.iOS[1662:17051] critical: 12 Foundation 0x000000010b0d3e7b __NSThreadPerformPerform + 330
2018-10-23 19:54:27.923874+0200 xxx.iOS[1662:17051] critical: 13 CoreFoundation 0x0000000111e52b31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
2018-10-23 19:54:27.924358+0200 xxx.iOS[1662:17051] critical: 14 CoreFoundation 0x0000000111e523a3 __CFRunLoopDoSources0 + 243
2018-10-23 19:54:27.924739+0200 xxx.iOS[1662:17051] critical: 15 CoreFoundation 0x0000000111e4ca4f __CFRunLoopRun + 1263
2018-10-23 19:54:27.925236+0200 xxx.iOS[1662:17051] critical: 16 CoreFoundation 0x0000000111e4c221 CFRunLoopRunSpecific + 625
2018-10-23 19:54:27.925682+0200 xxx.iOS[1662:17051] critical: 17 GraphicsServices 0x00000001183ae1dd GSEventRunModal + 62
2018-10-23 19:54:27.925978+0200 xxx.iOS[1662:17051] critical: 18 UIKitCore 0x000000011c5f1115 UIApplicationMain + 140
2018-10-23 19:54:27.926331+0200 xxx.iOS[1662:17051] critical: 19 ??? 0x00000001375aef3e 0x0 + 5223673662
2018-10-23 19:54:27.926718+0200 xxx.iOS[1662:17051] critical: 20 ??? 0x00000001375aecd3 0x0 + 5223673043
2018-10-23 19:54:27.927111+0200 xxx.iOS[1662:17051] critical:
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
The app has been terminated.
Expected Behavior
should not crash
Actual Behavior
Unhandled Exception: System.ObjectDisposedException: Cannot access a disposed object.
Basic Information
- Version with issue: 3.3.0.91254
- Last known good version: 3.1.0.697729
- IDE: visual studio 2017 community
- Platform Target Frameworks:
- iOS: 12