-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] ObjectDisposedException with CarouselView #2637
Comments
This comment has been minimized.
This comment has been minimized.
#2793 created as suggested |
@Magendanz do you have a repro for this by chance? I've tried a few random variations of carouselview with pickers and bindings and I'm not able to cause the above exception I'm curious what your layout and binding looks like |
Not a consistent repro case, no. In the field, I would receive the exception after about 20 mins to an hour of use. Typically, I'd update records with the dropdown every few minutes. |
@Magendanz looking at the stack trace I'm guessing there's an index change on the picker right as the page is changing I'll add some checks into the PickerRenderer but I'm curious if you just create a custom PickerRenderer yourself that looks something like below if that will fix your particular issue public class CustomPickerRenderer : PickerRenderer
{
bool isDisposed = false;
public CustomPickerRenderer(Context context) : base(context)
{
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if(!isDisposed)
base.OnElementPropertyChanged(sender, e);
}
protected override void Dispose(bool disposing)
{
isDisposed = true;
base.Dispose(disposing);
}
} |
Hmm a few things
|
BTW, I've checked the CustomPickerRenderer fix in the field, and am still receiving the ObjectDisposedExceptions. I'll try the nuget package next. |
So, the NuGet package from the feature_carouselview branch seems to be working, but I'll exercise it in the field tomorrow to confirm. (It's also the cleanest implementation so far, mirroring ListView nicely.) The only problem I have is that there's an issue on iOS where the first item selected is blank, even when swiping back to it later. This may have been fixed in the last 18 days, though. Is there a nightly feed for this feature branch or instructions somewhere for building a .nupkg of my own from the latest source? |
Also, setting SelectedItem doesn't work in that NuGet package you sent me, but setting Position does and that suffices as a workaround. I'm anxious to build a new package from the latest source. |
Unfortunately, the NuGet package failed our field tests. We're still getting the occasional System.ObjectDisposedException. Here's a crash log: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Android.Widget.EditText'.
|
we'd like to help, but we do not maintain or support alex's carousel view. we will provide a supported control that will allow that in 4.0.0 |
Description
When using alexrainman's CarouselView, I'm seeing pretty regular ObjectDisposedExceptions on Android. I don't see the problem with CarouselPage, but needed to switch to CarouselView for virtualization.
The crash is relatively rare (1 in 40), so I don't have consistent set of repo steps. It usually follows a Picker selection.
Note: This has been split off as a separate bug from Issue #2406, based on guidance from @hartez. There are at least three other related issues, but this one's specifically dealing with CarouselView.
Steps to Reproduce
Expected Behavior
We should see exactly the same behavior as with CarouselPage, but with improved performance due to UI virtualization.
Actual Behavior
Performance is much improved, but app will crash every hour or so given typical use.
Basic Information
This problem only occurs on Android. I've tested iOS builds and they seem fine. I have not yet been able to build using the feature-carouselview branch, but am very curious as to whether it's affected.
Sample stacktrace follows:
System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Android.Widget.EditText'.
JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self)
JniPeerMembers+JniInstanceMethods.InvokeNonvirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
TextView.set_HintFormatted (Java.Lang.ICharSequence value)
TextView.set_Hint (System.String value)
PickerRenderer.UpdatePicker ()
PickerRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e)
(wrapper delegate-invoke) .invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
BindableObject.OnPropertyChanged (System.String propertyName)
Element.OnPropertyChanged (System.String propertyName)
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)
BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes)
BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess)
BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value)
Picker.set_SelectedIndex (System.Int32 value)
Picker.UpdateSelectedIndex (System.Object selectedItem)
Picker.OnSelectedItemChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue)
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)
BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes)
BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget)
BindingExpression.Apply (System.Boolean fromTarget)
BindingExpression+BindingExpressionPart.b__47_0 ()
Thread+RunnableImplementor.Run ()
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
(wrapper dynamic-method) System.Object.0ceb0ba0-9872-4642-8dc3-2eb79185de62(intptr,intptr)
The text was updated successfully, but these errors were encountered: