question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

White or Black screen navigation on Android

See original GitHub issue

Description

We are migrating our apps from Xamarin to MAUI. Our apps use Shell and use routes all works as expected in windows and in Android… but behavior’s in android when you navigate during some time start to show white or black windows (depend of your theme android). I debug my app trying to understand what happen and I believe it is related to the memory:

In my case, for example: AnswerMailboxPage works perfectly any page works perfectly, but if you navigate may times for different page any page not render, navigate perfect: await Shell.Current.GoToAsync($“Todo.MailBox.AnswerMailboxPage?pIdMailbox={lMailboxItem.IdMessage}”); but not render the page and the debug output show this information in the case that show white or black screen

Steps to Reproduce

If you create any project with shell and navigate passing parameters to the page for about 30 times for different pages start this behaviour…

Link to public reproduction project repository

I can not share the code

Version with bug

6.0.312

Last version that worked well

6.0.312

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

No for the moment, I have also added to the android manifest android:enableOnBackInvokedCallback=“true” but nothing

Relevant log output

...
[ss.back.Android] Explicit concurrent copying GC freed 9664(520KB) AllocSpace objects, 7(188KB) LOS objects, 49% free, 8972KB/17MB, paused 26us,19us total 21.891ms
Thread started: <Thread Pool> #20
Resolved pending breakpoint at 'C:\greenYng\greenyngMOBILE\greenyng.mobile\greenyng.mobile.business.back\Views\Todo\MailBox\AnswerMailboxPage.xaml.cs:30,1' to void greenyng.mobile.business.back.Views.Todo.MailBox.AnswerMailboxPage..ctor () [0x00008].
[ss.back.Android] Explicit concurrent copying GC freed 2815(263KB) AllocSpace objects, 3(204KB) LOS objects, 49% free, 8848KB/17MB, paused 23us,19us total 24.077ms
[0:] Microsoft.Maui.Controls.Xaml.Diagnostics.BindingDiagnostics: Warning: '#FFFFFF' cannot be converted to type 'Microsoft.Maui.Graphics.Color'
[OnBackInvokedCallback] OnBackInvokedCallback is not enabled for the application.
[OnBackInvokedCallback] Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
[Choreographer] Skipped 1125 frames!  The application may be doing too much work on its main thread.
[OpenGLRenderer] Davey! duration=18725ms; Flags=0, FrameTimelineVsyncId=107687437, IntendedVsync=737426048460041, Vsync=737444758683791, InputEventId=0, HandleInputStart=737444762882262, AnimationStart=737444762883531, PerformTraversalsStart=737444763025377, DrawStart=737444763247339, FrameDeadline=737426081757240, FrameInterval=737444762848031, FrameStartTime=16630533, SyncQueued=737444763685069, SyncStart=737444763982839, IssueDrawCommandsStart=737444764761839, SwapBuffers=737444772667608, FrameCompleted=737444774241339, DequeueBufferDuration=43308, QueueBufferDuration=879115, GpuCompleted=737444774212146, SwapBuffersCompleted=737444774241339, DisplayPresentTime=737393480777606, CommandSubmissionCompleted=737444772667608, 
Thread started: <Thread Pool> #21
[0:] Microsoft.Maui.StreamImageSourceService: Warning: Unable to load image stream.

System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Microsoft.Maui.Controls.StreamImageSource.Microsoft.Maui.IStreamImageSource.GetStreamAsync(CancellationToken userToken) in D:\a\_work\1\s\src\Controls\src\Core\StreamImageSource.cs:line 48
   at Microsoft.Maui.StreamImageSourceService.GetDrawableAsync(IImageSource imageSource, Context context, CancellationToken cancellationToken) in D:\a\_work\1\s\src\Core\src\ImageSources\StreamImageSourceService\StreamImageSourceService.Android.cs:line 61
[0:] Microsoft.Maui.StreamImageSourceService: Warning: Unable to load image stream.

System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Microsoft.Maui.Controls.StreamImageSource.Microsoft.Maui.IStreamImageSource.GetStreamAsync(CancellationToken userToken) in D:\a\_work\1\s\src\Controls\src\Core\StreamImageSource.cs:line 48
   at Microsoft.Maui.StreamImageSourceService.GetDrawableAsync(IImageSource imageSource, Context context, CancellationToken cancellationToken) in D:\a\_work\1\s\src\Core\src\ImageSources\StreamImageSourceService\StreamImageSourceService.Android.cs:line 61
[0:] Microsoft.Maui.IViewHandler: Error: Unexpected exception in MapBackground.

System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Microsoft.Maui.Controls.StreamImageSource.Microsoft.Maui.IStreamImageSource.GetStreamAsync(CancellationToken userToken) in D:\a\_work\1\s\src\Controls\src\Core\StreamImageSource.cs:line 48
   at Microsoft.Maui.StreamImageSourceService.GetDrawableAsync(IImageSource imageSource, Context context, CancellationToken cancellationToken) in D:\a\_work\1\s\src\Core\src\ImageSources\StreamImageSourceService\StreamImageSourceService.Android.cs:line 76
   at Microsoft.Maui.Platform.ViewExtensions.UpdateBackgroundImageSourceAsync(View platformView, IImageSource imageSource, IImageSourceServiceProvider provider) in D:\a\_work\1\s\src\Core\src\Platform\Android\ViewExtensions.cs:line 353
   at Microsoft.Maui.TaskExtensions.FireAndForget(Task task, Action`1 errorCallback) in D:\a\_work\1\s\src\Core\src\TaskExtensions.cs:line 36
[0:] Microsoft.Maui.IViewHandler: Error: Unexpected exception in MapBackground.

System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Microsoft.Maui.Controls.StreamImageSource.Microsoft.Maui.IStreamImageSource.GetStreamAsync(CancellationToken userToken) in D:\a\_work\1\s\src\Controls\src\Core\StreamImageSource.cs:line 48
   at Microsoft.Maui.StreamImageSourceService.GetDrawableAsync(IImageSource imageSource, Context context, CancellationToken cancellationToken) in D:\a\_work\1\s\src\Core\src\ImageSources\StreamImageSourceService\StreamImageSourceService.Android.cs:line 76
   at Microsoft.Maui.Platform.ViewExtensions.UpdateBackgroundImageSourceAsync(View platformView, IImageSource imageSource, IImageSourceServiceProvider provider) in D:\a\_work\1\s\src\Core\src\Platform\Android\ViewExtensions.cs:line 353
   at Microsoft.Maui.TaskExtensions.FireAndForget(Task task, Action`1 errorCallback) in D:\a\_work\1\s\src\Core\src\TaskExtensions.cs:line 36

Issue Analytics

  • State:open
  • Created 7 months ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
kfranciscommented, Mar 17, 2023

blankScreen

Once we put the app in the background and then back in the foreground, it’s fine for a time but it does happen somewhat randomly. It happens 100% of the time when the app is first started, as seen in the above recording.

android_log.txt

0reactions
jinxinjuancommented, Aug 15, 2023

@kfrancis Not repro on android platform with Visual Studio Enterprise 17.8.0 Preview 1.0(.NET8) using this sample project (https://github.com/dotnet/maui-samples/tree/main/7.0/Navigation/ShellFlyoutSample), could you have a try on .NET8 to see if it works fine? Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Navigation Bar Keeps turning white
My nav bar is normally black to match my wallpaper. But randomly it turns white. Anybody know how to fix this?
Read more >
How to turn android phone display black and white - YouTube
This video will show you how to turn Android phone display black and white, or how change android phone color to black and...
Read more >
nav bar turned white on home screen, cant revert back to ...
Black hasn't been an option for navigation bar background color for a long time. Rumor has it Samsung noticed what you could call...
Read more >
The status bar icons have turned black ONLY on the home ...
The icons are black only on the Home screen. They are white on the recent apps screen, when any app is open, and...
Read more >
Turn on Dark theme and colour inversion - Android ...
Open your device's Settings app Settings app . · Select Accessibility. · Under 'Colour and motion'. select Colour inversion. · Turn on Use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found