microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.79k stars 319 forks source link

System.AggregateException on app start sometimes. #98

Closed Gavin-Williams closed 3 years ago

Gavin-Williams commented 4 years ago

Bug info Sometimes when my app starts, it will crash with a System.AggregateException on the App.xaml.cs line 70... rootFrame.Navigate(typeof(MainPage), e.Arguments);

Exception details...

System.AggregateException HResult=0x80131500 Message=One or more errors occurred. (More data is available.

More data is available. ) Source=Windows StackTrace: at Windows.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType, Object parameter) at GameRogueLegends.App.OnLaunched(LaunchActivatedEventArgs e) in E:\Dev\Projects\NukeProjects\GameRL\App.xaml.cs:line 70

Inner Exception 1: Exception: More data is available.

More data is available.

In the output window I get...

at Windows.Storage.StorageFolder.GetFoldersAsync() at Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider.GetAssemblyListAsync() --- End of inner exception stack trace --- at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()'. onecore\com\combase\winrt\error\restrictederror.cpp(1016)\combase.dll!756A2281: (caller: 755FD6D6) ReturnHr(4) tid(65a0) 8007007E The specified module could not be found. Exception thrown: 'System.AggregateException' in GameRL.exe An exception of type 'System.AggregateException' occurred in GameRL.exe but was not handled in user code One or more errors occurred.

Steps to reproduce the bug

I've started seeing this since updating to Windows 20/04 + SDK. It happens randomly when i run my uwp xaml project.

Expected behavior

App should run, and sometimes it does about 50/50 so far.

Screenshots

Version Info OS Version = 20/04 OS Build = 19041.330

NuGet package version: Microsoft.UI.Xaml.Markup Version = 10.0.0.0 / Runtime version = WindowsRuntime 1.4;CLR v4.0.30319 Universal Windows Identity = UAP,Version=10.0.19041.0

Windows 10 version Saw the problem?
May 2020 Update (19041) Yes
November 2019 Update (18363) No
May 2019 Update (18362) No
Device form factor Saw the problem?
Desktop YES
Xbox
Surface Hub
IoT

Additional context It looks like this is happening before any of my own code runs. Here's some extra output before the exception...

onecore\com\combase\dcomrem\resolver.cxx(2283)\combase.dll!755E8A91: (caller: 755EBD70) ReturnHr(1) tid(28b8) 800700EA More data is available. onecore\com\combase\dcomrem\resolver.cxx(2491)\combase.dll!755EBD91: (caller: 755E96FF) ReturnHr(2) tid(28b8) 800700EA More data is available. onecore\com\combase\winrtbase\brokeredactivation.cpp(754)\combase.dll!756A75DF: (caller: 755BFE59) ReturnHr(3) tid(28b8) 800700EA More data is available. Exception thrown: 'System.AggregateException' in System.Private.CoreLib.dll Exception thrown at 0x75C29862 (KernelBase.dll) in GameRL.exe: WinRT originate error - 0x80131500 : 'System.AggregateException: One or more errors occurred. (More data is available.

There was no bug reporting at the Project Reunion github, so I've had to submit this here.

BenJKuhn commented 4 years ago

I reached out to one of the engineers that works on CLR / WinRT interop. He indicated based on the data provided that it suggests that perhaps you have two CLR versions loaded in the same process. In his own words "that is a scenario with very sharp edges". Can you clarify if that's the case?

The activation is being delegated to a service start, which makes sense, but it means that the stack that you're sharing is very generic, and doesn't provide much in the say of specific diagnostic information. To really see what's happening, I can suggest a few ideas.

1) You may need to trace across processes. You can collect trace events for windows runtime failures across processes and view them in Windows Device Portal or WPA.

https://docs.microsoft.com/en-us/windows-hardware/test/wpt/windows-performance-analyzer

https://docs.microsoft.com/en-us/windows/uwp/debug-test-perf/device-portal

One provider that might be particularly helpful would be Microsoft-Windows-WinRT-Error. You can enable this tracing in the ETW logging tool in device portal and view the results directly in the web browser. Or you can set up a tracing profile and use the performance tracing tool to grab an ETL that you can look at in WPA, which will give you a more detailed view.

2) Another approach to debugging this would be to run the application under the native debugger, windbg. On failure, try running !analyze -v. It has more complex logic for diagnosing nested exceptions, and may provide a better hint as to the root cause of the failure.

I hope that's helpful. Unfortunately, with the information provided, there's not enough to go on yet to suggest a clear root cause.

Thanks,

Ben

Gavin-Williams commented 4 years ago

@BenJKuhn I certainly haven't intended to do that (have 2 CLR versions loaded). My project is a UWP Xaml app that calls a .Net Standard 2.0 class library where I have my engine/renderer running on it's own thread. I call into SharpDX to do all my rendering. This is a typical small game project, I'm not doing anything unusual. I'm using Xaml as my editor UI currently so that I can build the game map.

I'll try to follow what you've suggested. I'm not familiar with those steps, but I'll see what I can do to get some more info.

stevewri commented 3 years ago

@Gavin-Williams do you have any update regarding what @BenJKuhn suggested?

darrenstarr commented 3 years ago

I am receiving the same problem regularly. Is there a work around? I can't even run release builds

pkar70 commented 3 years ago

Similar problem here :)

And it is connected somewhat with two other problems:

  1. StorageFolder.GetFilesAsync ends with System.Exception: 'Exception from HRESULT: 0x80270301'; Source: "System.Private.CoreLib"
  2. Cannot login to MSA. "account problem, try to fix", and when I try to fix, some window dialogs? flashes, and... thats all. Cannot login from Apps:Settings:Account, from EdgeChromium, from Store, etc. But OneDrive is properly connected, also all login to MSA on webpages works correctly.

From event log:

Fault bucket 1624846248426590684, type 5 Event Name: WWAJSE Response: Not available Cab Id: 0

Problem signature: P1: Microsoft.Windows.CloudExperienceHost_10.0.19041.423_neutral_neutral_cw5n1h2txyewy P2: App P3: e3b0 P4: FFFFFFFD P5: (null) P6: 0_0 P7: P8: P9: P10:

Attached files: ErrorInfo.9932.15100.txt \?\C:\Windows\SystemApps\Microsoft.Windows.CloudExperienceHost_cw5n1h2txyewy\AppXManifest.xml \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERC8DF.tmp.WERInternalMetadata.xml \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERC90F.tmp.xml \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERC92D.tmp.csv \?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERC97C.tmp.txt

These files may be available here: \?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_Microsoft.Window_5c30d0885de93eec99eb836e988c76355dbdba4_00000000_c7b7436c-7680-454a-8981-26fbdd83018e

Analysis symbol: Rechecking for solution: 0 Report Id: 1536bc25-6d33-47e8-b29a-e5e8df4a8b89 Report Status: 268435456 Hashed bucket: 359aa658cfb960a5268c9d0ddc17d1dc Cab Guid: 0

When I created new local Windows account, all three symptoms are gone. And it is easily understood, it can be guessed than .GetAssemblyListAsync() uses GetFilesAsync(). My current solution is to use either build with target SDK 17134, or (when I want newer target, e.g. for WinUI NumberBox), use only Release build. But to copy all my settings from current account into new is very hard; reinstalling all programs also is not easy task. Also, it would require to reset Gmail-Outlook sync, and my email store is about 20 GB...

As it is "account related", it is probably somewhere in Registry (or file permissions?).

And I have only one CLR installed: (standard prompt, with admin rights): H:\Home\PIOTR\VStudio_Vs2017\iterateFilesTest>clrver Versions installed on the machine: v2.0.50727

H:\Home\PIOTR\VStudio_Vs2017\iterateFilesTest>

Or two, when using developer command prompt:


Visual Studio 2019 Developer Command Prompt v16.8.4 Copyright (c) 2020 Microsoft Corporation


H:\Home\PIOTR\VStudio_Vs2017\EnviroStatus>clrver

Microsoft (R) .NET CLR Version Tool Version 4.8.3928.0 Copyright (c) Microsoft Corporation. All rights reserved.

Versions installed on the machine: v2.0.50727 v4.0.30319

Or one, when using powershell: PS C:\Users\pkar> $PSVersionTable.CLRVersion

Major Minor Build Revision


4 0 30319 42000

So, is this CLR 4.0 installed "not completely"?

Last method: C:\Windows\Microsoft.NET\Framework> dir /a:d 17/08/2020 01:26

1032 17/08/2020 01:35 1037 17/08/2020 01:33 1045 17/08/2020 01:29 1049 10/11/2020 12:06 v1.0.3705 17/08/2020 02:47 v1.1.4322 14/10/2020 19:25 v2.0.50727 17/08/2020 01:21 v3.0 17/08/2020 01:35 v3.5 28/01/2021 21:11 v4.0.30319

C:\Windows\Microsoft.NET\Framework64> dir /a:d 17/08/2020 01:26

1032 17/08/2020 01:35 1037 17/08/2020 01:33 1045 17/08/2020 01:29 1049 14/10/2020 19:25 v2.0.50727 17/08/2020 01:21 v3.0 17/08/2020 01:35 v3.5 28/01/2021 21:07 v4.0.30319

And, in Device Portal, I have no "Microsoft-Windows-WinRT-Error" in registered providers list... :(

mesta1 commented 3 years ago

Similar issue here, here is the stack trace

System.AggregateException: One or more errors occurred. (More data is available.

More data is available. ) ---> System.Exception: More data is available.

More data is available.

at Windows.Storage.StorageFolder.GetFoldersAsync() at Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider.GetAssemblyListAsync() --- End of inner exception stack trace --- at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()

schouffy commented 2 years ago

Same issue as mesta1, also with GetFoldersAsync call in the call stack.

at Windows.Storage.StorageFolder.GetFoldersAsync() at Microsoft.UI.Xaml.Markup.ReflectionXamlMetadataProvider.<GetAssemblyListAsync>d__6.MoveNext()