Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAUI application error due to entry element in background operation #13762

Closed
TurlovDV opened this issue Mar 8, 2023 · 3 comments
Closed

MAUI application error due to entry element in background operation #13762

TurlovDV opened this issue Mar 8, 2023 · 3 comments

Comments

@TurlovDV
Copy link

TurlovDV commented Mar 8, 2023

Description

I am developing an application where there is support for background work, but an error has occurred that I cannot fix. The essence of the error in the application is that if you exit the application, leaving it in the background, and then log in again, the error System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'Microsoft.Maui.Platform.Maui AppCompatEditText'.'

I found a pattern that the error directly depends on the presence of entry or editor elements on the xaml display page, with them wrapped in a frame (without working fine).

Steps to Reproduce

  1. Create a MAUI app
  2. Enable background service
  3. Add entry or editor wrapped in frame
  4. Exit the application in the background
  5. When you re-enter, an error pops up

Link to public reproduction project repository

https://github.com/TurlovDV/MauiBackgroundError

Version with bug

7.0 (current)

Last version that worked well

7.0 (current)

Affected platforms

Android

Affected platform versions

Android 12

Did you find any workaround?

No response

Relevant log output

0xFFFFFFFFFFFFFFFF in Android.Runtime.JNIEnv.monodroid_debugger_unhandled_exception	C#
 	0x1A in Android.Runtime.JNINativeWrapper._unhandled_exception at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:12,5	C#
 	0x23 in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:353,26	C#
 	0x2E in Java.Interop.JniPeerMembers.AssertSelf at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.cs:153,5	C#
 	0x1 in Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod at /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:57,5	C#
 	0x3D in Android.Views.View.RemoveOnAttachStateChangeListener at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.View.cs:20656,5	C#
 	0x7 in Android.Views.View. at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.View.cs:23401,12	C#
 	0x3E in Java.Interop.EventHelper.RemoveEventHandler<Android.Views.View.IOnAttachStateChangeListener, Android.Views.View.IOnAttachStateChangeListenerImplementor> at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Interop/EventHelper.cs:35,5	C#
 	0x3E in Android.Views.View.remove_ViewAttachedToWindow at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net7.0/android-33/mcw/Android.Views.View.cs:23398,5	C#
 	0x4F in Microsoft.Maui.Handlers.EditorHandler.DisconnectHandler at D:\a\_work\1\s\src\Core\src\Handlers\Editor\EditorHandler.Android.cs:61,3	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IEditor,AndroidX.AppCompat.Widget.AppCompatEditText>.OnDisconnectHandler at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:79,4	C#
 	0x13 in Microsoft.Maui.Handlers.ViewHandler.OnDisconnectHandler at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:156,4	C#
 	0x2 in Microsoft.Maui.Handlers.ElementHandler.DisconnectHandler at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:112,4	C#
 	0x20 in Microsoft.Maui.Handlers.ElementHandler.Microsoft.Maui.IElementHandler.DisconnectHandler at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:130,5	C#
 	0x64 in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:66,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:19,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:308,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0x36 in Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer.UpdateContent at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Android\FrameRenderer.cs:316,4	C#
 	0x1 in Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer.<>c.<.cctor>b__64_6 at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Android\FrameRenderer.cs:31,54	C#
 	0x21 in Microsoft.Maui.PropertyMapper<Microsoft.Maui.Controls.Frame,Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer>. at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:172,6	C#
 	0x17 in Microsoft.Maui.PropertyMapper.UpdatePropertyCore at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:47,4	C#
 	0x1D in Microsoft.Maui.PropertyMapper.UpdateProperties at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:82,5	C#
 	0xE3 in Microsoft.Maui.Controls.Handlers.Compatibility.VisualElementRenderer<Microsoft.Maui.Controls.Frame>.SetVirtualView at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\VisualElementRenderer.cs:280,4	C#
 	0x1B in Microsoft.Maui.Controls.Handlers.Compatibility.ViewHandlerDelegator<Microsoft.Maui.Controls.Frame>.SetVirtualView at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\ViewHandlerDelegator.cs:86,4	C#
 	0x26 in Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer.Microsoft.Maui.IElementHandler.SetVirtualView at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Android\FrameRenderer.cs:347,3	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:69,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:19,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:308,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0xAC in Microsoft.Maui.Handlers.LayoutHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Layout\LayoutHandler.Android.cs:43,5	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.ILayout,Microsoft.Maui.Platform.LayoutViewGroup>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:69,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:19,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:308,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0x1D in Microsoft.Maui.Handlers.ScrollViewHandler.UpdateInsetView at D:\a\_work\1\s\src\Core\src\Handlers\ScrollView\ScrollViewHandler.Android.cs:175,4	C#
 	0x13 in Microsoft.Maui.Handlers.ScrollViewHandler.MapContent at D:\a\_work\1\s\src\Core\src\Handlers\ScrollView\ScrollViewHandler.Android.cs:109,4	C#
 	0x21 in Microsoft.Maui.PropertyMapper<Microsoft.Maui.IScrollView,Microsoft.Maui.Handlers.IScrollViewHandler>. at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:172,6	C#
 	0x17 in Microsoft.Maui.PropertyMapper.UpdatePropertyCore at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:47,4	C#
 	0x1D in Microsoft.Maui.PropertyMapper.UpdateProperties at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:82,5	C#
 	0xCB in Microsoft.Maui.Handlers.ElementHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:79,4	C#
 	0x2 in Microsoft.Maui.Handlers.ViewHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:129,4	C#
 	0x2 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IScrollView,Microsoft.Maui.Platform.MauiScrollView>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:53,4	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IScrollView,Microsoft.Maui.Platform.MauiScrollView>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:69,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:19,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:308,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ElementExtensions.ToPlatform at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:127,4	C#
 	0x60 in Microsoft.Maui.Handlers.ContentViewHandler.UpdateContent at D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:44,5	C#
 	0x1 in Microsoft.Maui.Handlers.ContentViewHandler.MapContent at D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:49,4	C#
 	0x21 in Microsoft.Maui.PropertyMapper<Microsoft.Maui.IContentView,Microsoft.Maui.Handlers.IContentViewHandler>. at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:172,6	C#
 	0x17 in Microsoft.Maui.PropertyMapper.UpdatePropertyCore at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:47,4	C#
 	0x1D in Microsoft.Maui.PropertyMapper.UpdateProperties at D:\a\_work\1\s\src\Core\src\PropertyMapper.cs:82,5	C#
 	0xCB in Microsoft.Maui.Handlers.ElementHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:79,4	C#
 	0x2 in Microsoft.Maui.Handlers.ViewHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:129,4	C#
 	0x2 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IContentView,Microsoft.Maui.Platform.ContentViewGroup>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:53,4	C#
 	0x2 in Microsoft.Maui.Handlers.ContentViewHandler.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\ContentView\ContentViewHandler.Android.cs:27,4	C#
 	0x7 in Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.IContentView,Microsoft.Maui.Platform.ContentViewGroup>.SetVirtualView at D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:56,4	C#
 	0x8B in Microsoft.Maui.Controls.Element.SetHandler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:69,6	C#
 	0x2 in Microsoft.Maui.Controls.Element.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:19,11	C#
 	0x18 in Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler at D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:308,5	C#
 	0xB0 in Microsoft.Maui.Platform.ElementExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:96,4	C#
 	0x2 in Microsoft.Maui.Platform.ViewExtensions.ToHandler at D:\a\_work\1\s\src\Core\src\Platform\ViewExtensions.cs:43,4	C#
 	0x92 in Microsoft.Maui.Controls.Platform.Compatibility.ShellFragmentContainer.OnCreateView at D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellFragmentContainer.cs:50,4	C#
 	0x24 in AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ at /Users/runner/work/1/s/generated/androidx.fragment.fragment/obj/Release/net6.0-android/generated/src/AndroidX.Fragment.App.Fragment.cs:2031,4	C#
 	0xD in Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPLLL_L at /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:352,5	C#
@TurlovDV TurlovDV added the t/bug Something isn't working label Mar 8, 2023
@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Mar 8, 2023
@mattleibow
Copy link
Member

Does this start to work when you switch to a Border?

@ghost
Copy link

ghost commented Mar 8, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@TurlovDV
Copy link
Author

TurlovDV commented Mar 9, 2023

Начинает ли это работать при переключении на aBorder?
Yes, it helped, thank you

@TurlovDV TurlovDV closed this as completed Mar 9, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 8, 2023
@samhouts samhouts modified the milestones: Backlog, .NET 8 May 24, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants