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

[Android] NullReferenceException in ShellFlyoutTemplatedContentRenderer.HeaderContainer.UpdateMinimumHeight #13825

Closed
BioTurboNick opened this issue Mar 10, 2023 · 2 comments · Fixed by #16573
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-8.0.90 fixed-in-9.0.0-rc.2.24503.2 high It doesn't work at all, crashes or has a big impact. platform/android 🤖 t/bug Something isn't working
Milestone

Comments

@BioTurboNick
Copy link
Contributor

Description

Report in AppCenter of a NullReferenceException in ShellFlyoutTemplatedContentRenderer.HeaderContainer.UpdateMinimumHeight

I haven't seen this crash before 7.0.59, but I can't say it isn't just something rare I haven't yet seen.

Opportunities for nulls are:

  • Context on line 772, 776
  • PlatformView on line 792

Assuming the isolated error can be addressed, perhaps line 792 should at a minimum change to PlatformView?.MinimumHeight != minHeight) ?

void UpdateMinimumHeight()
{
var minHeight = 0;
if (View?.MinimumHeightRequest > 0)
{
minHeight = (int)Context.ToPixels(View.MinimumHeightRequest);
}
else if (_flyoutHeaderBehavior == FlyoutHeaderBehavior.CollapseOnScroll)
{
minHeight = Context.GetActionBarHeight();
}
else
{
minHeight = 0;
}
if (MinimumHeight != minHeight)
this.SetMinimumHeight(minHeight);
if (Parent is AView frameLayoutView &&
minHeight > frameLayoutView.MinimumHeight)
{
frameLayoutView.SetMinimumHeight(minHeight);
}
if (PlatformView.MinimumHeight != minHeight)
{
PlatformView.SetMinimumHeight(minHeight);
}
}

Steps to Reproduce

Unknown

Link to public reproduction project repository

not yet

Version with bug

7.0 (current)

Last version that worked well

7.0 (current)

Affected platforms

Android

Affected platform versions

Android 10

Did you find any workaround?

No response

Relevant log output

Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedContentRenderer.HeaderContainer.UpdateMinimumHeight()
Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedContentRenderer.HeaderContainer.OnMeasure(Int32 widthMeasureSpec, Int32 heightMeasureSpec)
Android.Views.View.n_OnMeasure_II(IntPtr , IntPtr , Int32 , Int32 )
Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPII_V(_JniMarshal_PPII_V , IntPtr , IntPtr , Int32 , Int32 )
@BioTurboNick BioTurboNick added the t/bug Something isn't working label Mar 10, 2023
@jsuarezruiz jsuarezruiz added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Mar 13, 2023
@BioTurboNick
Copy link
Contributor Author

bump - if someone could just tell me if the simple null-guarding change is fine, I'll make the PR for it.

@fekberg
Copy link

fekberg commented May 9, 2023

I'm getting this on Pixel 7 and One Plus 8 Pro, but not on any Samsung phones.

@samhouts samhouts added this to the Under Consideration milestone Aug 10, 2023
@samhouts samhouts added high It doesn't work at all, crashes or has a big impact. platform/android 🤖 labels Aug 10, 2023
@PureWeen PureWeen modified the milestones: Under Consideration, Backlog Aug 2, 2024
@PureWeen PureWeen modified the milestones: Backlog, .NET 8 SR9 Aug 19, 2024
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Aug 19, 2024
@github-project-automation github-project-automation bot moved this from Ready To Review to Done in MAUI SDK Ongoing Sep 5, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-8.0.90 fixed-in-9.0.0-rc.2.24503.2 high It doesn't work at all, crashes or has a big impact. platform/android 🤖 t/bug Something isn't working
Projects
Status: Done
5 participants