-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Closed
Copy link
Labels
area-core-platformIntegration with platformsIntegration with platformsplatform/androidpotential-regressionThis issue described a possible regression on a currently supported version., verification pendingThis issue described a possible regression on a currently supported version., verification pendingt/bugSomething isn't workingSomething isn't working
Description
Description
According to the AppCenter logs, I see that the application crashes after closing some pages.
Steps to Reproduce
I can't attach steps to reproduce because I only see this crash in the AppCenter logs.
Link to public reproduction project repository
No response
Version with bug
9.0.70 SR7
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
public class FixedImageHandler : ImageHandler
{
public FixedImageHandler() { }
public FixedImageHandler(IPropertyMapper? mapper) : base(mapper) { }
public FixedImageHandler(IPropertyMapper? mapper, CommandMapper? commandMapper) : base(mapper, commandMapper) { }
protected override ImageView CreatePlatformView()
{
var imageView = new FixedAppCompatImageView(Context);
// Enable view bounds adjustment on measure.
// This allows the ImageView's OnMeasure method to account for the image's intrinsic
// aspect ratio during measurement, which gives us more useful values during constrained
// measurement passes.
imageView.SetAdjustViewBounds(true);
return imageView;
}
}
public class FixedAppCompatImageView : AppCompatImageView
{
protected FixedAppCompatImageView(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
}
public FixedAppCompatImageView(Context context) : base(context)
{
}
public FixedAppCompatImageView(Context context, IAttributeSet? attrs) : base(context, attrs)
{
}
public FixedAppCompatImageView(Context context, IAttributeSet? attrs, int defStyleAttr) : base(context, attrs, defStyleAttr)
{
}
public override void RemoveOnAttachStateChangeListener(IOnAttachStateChangeListener? listener)
{
if (this.IsNotAlive() || listener.IsNotAlive())
return;
base.RemoveOnAttachStateChangeListener(listener);
}
}Relevant log output
System.ObjectDisposedException: ObjectDisposed_Generic
ObjectDisposed_ObjectName_Name, AndroidX.AppCompat.Widget.AppCompatImageView
at Java.Interop.JniPeerMembers.AssertSelf(IJavaPeerable )
at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String , IJavaPeerable , JniArgumentValue* )
at Android.Views.View.RemoveOnAttachStateChangeListener(IOnAttachStateChangeListener )
at Android.Views.View.<>c__DisplayClass3033_0.<remove_ViewDetachedFromWindow>b__0(IOnAttachStateChangeListener __v)
at Java.Interop.EventHelper.RemoveEventHandler[IOnAttachStateChangeListener,IOnAttachStateChangeListenerImplementor](WeakReference& , Func`2 , Action`1 , Action`1 )
at Android.Views.View.remove_ViewDetachedFromWindow(EventHandler`1 )
at Microsoft.Maui.Platform.ViewExtensions.<>c__DisplayClass43_0.<OnUnloaded>b__1()
at Microsoft.Maui.Platform.ActionDisposable.Dispose()
at Microsoft.Maui.Platform.ViewExtensions.<>c__DisplayClass43_0.<OnUnloaded>b__3()
at Java.Lang.Thread.RunnableImplementor.Run()
at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz)
at Java.Interop.JniPeerMembers.AssertSelf(IJavaPeerable )
at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String , IJavaPeerable , JniArgumentValue* )
at Android.Views.View.RemoveOnAttachStateChangeListener(IOnAttachStateChangeListener )
at Android.Views.View.<>c__DisplayClass3033_0.<remove_ViewDetachedFromWindow>b__0(IOnAttachStateChangeListener __v)
at Java.Interop.EventHelper.RemoveEventHandler[IOnAttachStateChangeListener,IOnAttachStateChangeListenerImplementor](WeakReference& , Func`2 , Action`1 , Action`1 )
at Android.Views.View.remove_ViewDetachedFromWindow(EventHandler`1 )
at Microsoft.Maui.Platform.ViewExtensions.<>c__DisplayClass43_0.<OnUnloaded>b__1()
at Microsoft.Maui.Platform.ActionDisposable.Dispose()
at Microsoft.Maui.Platform.ViewExtensions.<>c__DisplayClass43_0.<OnUnloaded>b__3()
at Java.Lang.Thread.RunnableImplementor.Run()
at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz) <1><>Metadata
Metadata
Assignees
Labels
area-core-platformIntegration with platformsIntegration with platformsplatform/androidpotential-regressionThis issue described a possible regression on a currently supported version., verification pendingThis issue described a possible regression on a currently supported version., verification pendingt/bugSomething isn't workingSomething isn't working