White or Black screen navigation on Android
See original GitHub issueDescription
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:
- Created 7 months ago
- Comments:8
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
@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.