Skip to content

[Android] Microsoft.Maui.Platform.MauiTextView ObjectDisposedException #29676

Open
@claytonone

Description

@claytonone

Description

After upgrading from .net 8 to .net 9 we are now seeing loads of exceptions related to MauiTextView on Android. We're not entirely sure what's causing it as the stack trace is all native but it seems to happen sometimes when you navigate back from a page that contains an Entry. (See stack trace below). This was not a problem in .net 8

Steps to Reproduce

No response

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

8.0.100 SR10

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

System.ObjectDisposedException: ObjectDisposed_Generic
ObjectDisposed_ObjectName_Name, Microsoft.Maui.Platform.MauiTextView
  ?, in void JniPeerMembers.AssertSelf(IJavaPeerable)
  ?, in void JniInstanceMethods.InvokeVirtualVoidMethod(string, IJavaPeerable, JniArgumentValue*)
  ?, in void View.RemoveOnAttachStateChangeListener(IOnAttachStateChangeListener)
  ?, in void View.remove_ViewDetachedFromWindow(EventHandler<ViewDetachedFromWindowEventArgs>)+(IOnAttachStateChangeListener __v) => { } [0]
  ?, in void EventHelper.RemoveEventHandler<IOnAttachStateChangeListener, IOnAttachStateChangeListenerImplementor>(ref WeakReference, Func<IOnAttachStateChangeListenerImplementor, bool>, Action<IOnAttachStateChangeListener>, Action<IOnAttachStateChangeListenerImplementor>)
  ?, in void View.remove_ViewDetachedFromWindow(EventHandler<ViewDetachedFromWindowEventArgs>)
  ?, in IDisposable ViewExtensions.OnUnloaded(View view, Action action)+() => { } [1]
  ?, in void ActionDisposable.Dispose()
  ?, in IDisposable ViewExtensions.OnUnloaded(View view, Action action)+() => { } [3]
  ?, in void RunnableImplementor.Run()
  ?, in void IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)
  ?, in void JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions