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

TabbedPage running on Android Emulator - Unhandled Exception #6349

Closed
Cywizz opened this issue Apr 21, 2022 · 3 comments · Fixed by #6390
Closed

TabbedPage running on Android Emulator - Unhandled Exception #6349

Cywizz opened this issue Apr 21, 2022 · 3 comments · Fixed by #6390
Assignees
Labels
fixed-in-6.0.300-rc.3 Look for this fix in 6.0.300-rc.3! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@Cywizz
Copy link

Cywizz commented Apr 21, 2022

Description

I am getting a System.NullReferenceException using a TabbedPage on the Android Emulator.
Windows Machine works fine.
First time using TabbedPage in MAUI so not sure if or in which version this worked before.

Steps to Reproduce

1.Create a new .Net MAUI app
2. Change the MainPage.xaml from ContentPage to TabbedPage
3. Wrap the template's ScrollView in a ContentPage
4. Change MainPage class to inherit from TabbedPage
5. Run using Android Emulator (I used Pixel 5 - API 30(Android 11)
6. Unhandled Exception thrown

Version with bug

Release Candidate 1 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11 - API 30

Did you find any workaround?

No

Relevant log output

System.NullReferenceException: 'Object reference not set to an instance of an object.'
@Cywizz Cywizz added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Apr 21, 2022
@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Apr 21, 2022
@XamlTest
Copy link

Verified this issue with Visual Studio Enterprise 17.3.0 Preview 1.0 [32414.199.main]. Repro on Android, not repro on Windows. Sample Project: 6349.zip

@jsuarezruiz
Copy link
Contributor

Thread started: <Thread Pool> #6
Thread started: .NET ThreadPool Gate #7
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
[mono-rt]    at Microsoft.Maui.Controls.Handlers.TabbedPageManager.SetTabLayout() in D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\TabbedPageManager.cs:line 238
[mono-rt]    at Microsoft.Maui.Controls.Handlers.TabbedPageManager.SetElement(TabbedPage tabbedPage) in D:\a\_work\1\s\src\Controls\src\Core\Platform\Android\TabbedPageManager.cs:line 160
[mono-rt]    at Microsoft.Maui.Controls.TabbedPage.CreatePlatformView() in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\TabbedPage\TabbedPage.Android.cs:line 23
[mono-rt]    at Microsoft.Maui.Controls.TabbedPage.OnCreatePlatformView(ViewHandler`2 arg) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\TabbedPage\TabbedPage.Android.cs:line 30
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ITabbedView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Android.Views.View, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].OnCreatePlatformView() in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 72
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler.OnCreatePlatformElement() in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:line 121
[mono-rt]    at Microsoft.Maui.Handlers.ElementHandler.CreatePlatformElement() in D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 96
[mono-rt]    at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 52
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler.SetVirtualView(IElement element) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:line 127
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ITabbedView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Android.Views.View, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].SetVirtualView(IView view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 53
[mono-rt]    at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ITabbedView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Android.Views.View, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].SetVirtualView(IElement view) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 56
[mono-rt]    at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 64
[mono-rt]    at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\Element\Element.Impl.cs:line 20
[mono-rt]    at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler(IElementHandler value) in D:\a\_work\1\s\src\Controls\src\Core\HandlerImpl\VisualElement\VisualElement.Impl.cs:line 295
[mono-rt]    at Microsoft.Maui.Platform.ElementExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ElementExtensions.cs:line 96
[mono-rt]    at Microsoft.Maui.Platform.ViewExtensions.ToHandler(IView view, IMauiContext context) in D:\a\_work\1\s\src\Core\src\Platform\ViewExtensions.cs:line 44
[mono-rt]    at Microsoft.Maui.Controls.Platform.Compatibility.ShellFragmentContainer.OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) in D:\a\_work\1\s\src\Controls\src\Core\Compatibility\Handlers\Shell\Android\ShellFragmentContainer.cs:line 41
[mono-rt]    at AndroidX.Fragment.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_inflater, IntPtr native_container, IntPtr native_savedInstanceState) in C:\a\_work\1\s\generated\androidx.fragment.fragment\obj\Release
et6.0-android\generated\src\AndroidX.Fragment.App.Fragment.cs:line 1999

@PureWeen
Copy link
Member

#6389

@ghost ghost locked as resolved and limited conversation to collaborators May 22, 2022
@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Jul 12, 2022
@samhouts samhouts added the fixed-in-6.0.300-rc.3 Look for this fix in 6.0.300-rc.3! label Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-6.0.300-rc.3 Look for this fix in 6.0.300-rc.3! p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
5 participants