Repository: dotnet/maui

Issue #12313: Shell Navigation in OnAppearing Causes Fault on Windows
Created: 2022-12-28T01:22:59Z
Description
I wanted to show a one-time page so made it first in a shell and then navigated to the "real" first page when it was done (or not needed). Navigation when it was done worked fine, but immediate navigation when it was not needed caused a fault in WinRT
Steps to Reproduce

Build the project and run it on Windows, the first time it will run correctly, and you'll see a timed "One Time" page, then a timed "Startup" page and finally switch to a UI which allows user interaction.
Run it again, this (and subsequent) times it will detect it has run before and try to navigate straight to the Startup page from the "One Time" page. This will fault in WinRT code and if you are running with native debug enabled you'll see messages like this:

Exception thrown: 'System.InvalidOperationException' in Microsoft.Maui.Controls.dll
Exception thrown at 0x00007FFDEC00CD29 (KernelBase.dll) in MultiPage.exe: WinRT originate error - 0x80131509 : 'Pending Navigations still processing'.
onecore\com\combase\winrt\error\restrictederror.cpp(1016)\combase.dll!00007FFDED935A43: (caller: 00007FFDED8FCA9D) ReturnHr(1) tid(d574) 8007007E The specified module could not be found.
Exception thrown at 0x00007FFDEC00CD29 (KernelBase.dll) in MultiPage.exe: WinRT originate error - 0x80131509 : 'A failure occurred in Application::OnLaunched, the application is unable to start.'.


It works fine on Android but the same failure occurs whether .NET 6 or 7 is used on Windows.
Link to public reproduction project repository
https://github.com/david-maw/MultiPage-OneTimePage.git
Version with bug
6.0.486
Last version that worked well
Unknown/Other
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
Windows 10
Did you find any workaround?
Yes, calling await Task.Delay(1) before navigating away from the One Time use page makes the symptom go away.
Relevant log output
No response

Duplicate issue #12355: MAUI program crash upon startup
Created: 2022-12-30T15:50:49Z
Description
'MyVoiceApp3.exe' (CoreCLR: DefaultDomain): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\MyVoiceApp3.dll'. Symbols loaded.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Projection.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.InteropServices.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\WinRT.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Collections.Concurrent.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.CompilerServices.Unsafe.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Private.Uri.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.ObjectModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.ComponentModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MyVoiceApp3.exe' (CoreCLR: clrhost): Loaded 'D:\vsprojects\MyVoiceApp3\MyVoiceApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Numerics.Vectors.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[23180] MyVoiceApp3.exe' has exited with code 2147942405 (0x80070005).

Steps to Reproduce
Run the program
Link to public reproduction project repository
https://github.com/ourweb4/MyVoiceApp3a.git
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
All
Did you find any workaround?
No response
Relevant log output
No response

Closing comment (2023-01-05T21:46:16Z): same problem

What is the same problem? We need to know what you tried and what happened. This issue was closed as a duplicate of #12313 so please discuss on that open issue. Thanks!