ObjectDisposedException: Cannot access a disposed object on BottomNavigationView
Closed this issue · 3 comments
Hi everyone,
i have a problem.
I used the badge here:
<Tab x:Name="tabNotifications" Route="notifications"
Title="{translator:Translate NOTIFICATIONS}"
badge:Badge.Text="{Binding NotificationCount}"
badge:Badge.BackgroundColor="White">
<ShellContent ContentTemplate="{DataTemplate local:NotificationsPage}" />
<Tab.Icon>
<FontImageSource FontFamily="MR" Glyph="notifications_none" Size="Small"/>
</Tab.Icon>
</Tab>
I launch my android app with the command MainPage = new AppShell(); and first time it's all ok.
Then i have to recall the command MainPage = new AppShell(); but at the end i obtain the following error message:
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object. [mono-rt] Object name: 'Google.Android.Material.BottomNavigation.BottomNavigationView'. [mono-rt] at Java.Interop.JniPeerMembers.AssertSelf (Java.Interop.IJavaPeerable self) [0x00029] in <dd8770963db64939be322a2c6d46563b>:0 [mono-rt] at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00000] in <dd8770963db64939be322a2c6d46563b>:0 [mono-rt] at Android.Views.ViewGroup.GetChildAt (System.Int32 index) [0x00018] in /Users/builder/azdo/_work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-29/mcw/Android.Views.ViewGroup.cs:3080 [mono-rt] at Xam.Shell.Badge.Droid.Renderers.BadgeShellItemRenderer.ApplyBadge (System.Int32 itemId, System.String badgeText, Xamarin.Forms.Color badgeBg, Xamarin.Forms.Color textColor) [0x00009] in <15a092f193ea4a8aa187f247325b3148>:0 [mono-rt] at Xam.Shell.Badge.Droid.Renderers.BadgeShellItemRenderer.UpdateBadge (Xamarin.Forms.ShellSection item, System.Int32 index) [0x0001a] in <15a092f193ea4a8aa187f247325b3148>:0 [mono-rt] at Xam.Shell.Badge.Droid.Renderers.BadgeShellItemRenderer.InitBadges () [0x0003d] in <15a092f193ea4a8aa187f247325b3148>:0 [mono-rt] at Xamarin.Forms.Device+<>c__DisplayClass43_0.<InvokeOnMainThreadAsync>g__wrapAction|0 () [0x00000] in D:\a\_work\1\s\Xamarin.Forms.Core\Device.cs:130 [mono-rt] at Xamarin.Forms.Device+<>c__DisplayClass42_0
1[T].b__0 () [0x00000] in D:\a_work\1\s\Xamarin.Forms.Core\Device.cs:116
[mono-rt] --- End of stack trace from previous location where exception was thrown ---
[mono-rt] at Xam.Shell.Badge.Droid.Renderers.BadgeS04-11 23:38:56.951 F/mono-rt (18600):
[mono-rt] at AsyncAwaitBestPractices.SafeFireAndForgetExtensions.HandleSafeFireAndForget[TException] (System.Threading.Tasks.Task task, System.Boolean continueOnCapturedContext, System.Action1[T] onException) [0x0006f] in <8039d31f240b405abc8435fcdbcacf54>:0 [mono-rt] at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.32(intptr,intptr) [mono-rt] at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.32(intptr,intptr) [HostConnection] HostConnection::get() New Host Connection established 0x7310f2a3ebd0, tid 18600 [HostConnection] HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_2
@Imodejam, thank you, i have identified an issue and will publish PR shortly.
@Imodejam, hello, if possible, please confirm this issue is resolved within the recent 1.0.20.
@Imodejam, hello, after i've performed some tests, i can confirm this issue is resolved. Please, create new issue if you have any other problem going on.