microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.34k stars 677 forks source link

XamlParseException on RS4 & RS5 #2583

Open tipa opened 4 years ago

tipa commented 4 years ago

Describe the bug App crashes on some users machines, crash reports coming from AppCenter:

One device running 10.0.17134 Windows.UI.Xaml.Markup.XamlParseException: The text associated with this error code could not be found. Cannot locate resource from 'ms-appx://Microsoft.UI.Xaml.2.4/Microsoft.UI.Xaml/Themes/rs4_themeresources.xaml [Line: 0 Position: 0]

Another one running 10.0.1776: Windows.UI.Xaml.Markup.XamlParseException: The text associated with this error code could not be found. Cannot locate resource from 'ms-appx://Microsoft.UI.Xaml.2.4/Microsoft.UI.Xaml/Themes/rs5_themeresources.xaml'. [Line: 0 Position: 0]

I am only using <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" /> in my App.xml and muxc:NavigationView from the WinUI library

NuGet package version: Microsoft.UI.Xaml 2.4.0

Windows 10 version Saw the problem?
Insider Build (xxxxx) No
November 2019 Update (18363) No
May 2019 Update (18362) No
October 2018 Update (17763) Yes
April 2018 Update (17134) Yes
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Mobile
Xbox
Surface Hub
IoT
StephenLPeters commented 4 years ago

@tipa can you confirm that you followed the getting started steps here: https://docs.microsoft.com/en-us/windows/apps/winui/winui2/getting-started and are still seeing the issue? if so can you please attach a repro app so we can take a look at the specific issue?

tipa commented 4 years ago

Yes I followed that guide. I can only see this crash being reported for 2 devices (out of a reported install base of currently ~2.000) so I don't know how this issue could be easily reproduced on one of our machines. I am using the library in a UWP app if that helps...

StephenLPeters commented 4 years ago

Are the 2 devices the only ones that are on RS4/RS5? Are there users on RS4/5 that aren't hitting this crash?

tipa commented 4 years ago

There are other RS4 and RS5 devices running my app but it only crashes on those 2 specific ones

ranjeshj commented 4 years ago

If this crash is happening in just a handful of RS4/RS5 machines it makes me think there is some issue with the package installation. @kmahone was investigating a similar issue in our build/test pipelines where once in while a machine would end up in a weird state in down-level operating systems.

kmahone commented 4 years ago

The package itself must be getting installed, since M.U.X.dll is getting loaded (otherwise we wouldn't see this error).

For some reason, the process is failing to load resources from the package.

ranjeshj commented 4 years ago

Looking at the message again. Perhaps the app is failing somewhere and this is the message when trying to resolve some error text message ? If you happen to have a repro, can you enable native exceptions and get a callstack where it is thrown ?

tipa commented 4 years ago

I cannot reproduce this locally on my machines unfortunately. If it somehow helps, the app is available to download in the Microsoft Store. I can also now see 2 RS5 devices for which the app crashes (out of a total of 454 RS5 devices).

tipa commented 4 years ago

I can now see other/additional errors

10.0.19041: Windows.UI.Xaml.Markup.XamlParseException: Не удалось найти текст, связанный с этим кодом ошибки. Cannot create instance of type 'Microsoft.UI.Xaml.Controls.XamlControlsResources' [Line: 0 Position: 0]

10.0.17763: Windows.UI.Xaml.Markup.XamlParseException: The text associated with this error code could not be found. Cannot create instance of type 'Microsoft.UI.Xaml.Controls.XamlControlsResources' [Line: 0 Position: 0]

10.0.17134: Windows.UI.Xaml.LayoutCycleException: Cannot find a Resource with the Name/Key CalendarDatePickerTopHeaderMargin Cannot find a Resource with the Name/Key CalendarDatePickerTopHeaderMargin

kmahone commented 4 years ago

Interesting. So I think I understand the issue with 'CalendarDatePickerTopHeaderMargin'. However, that is only going to be hit on RS4 and below. I think that is a different issue to the Cannot locate resource from 'ms-appx://Microsoft.UI.Xaml.2.4/Microsoft.UI.Xaml/Themes/rs4_themeresources.xaml problem at the top of this thread.

Do you have access to the crash dumps? Or just the error message?

tipa commented 4 years ago

I just got these crash reports from AppCenter, never was able to reproduce this on my devices... :/

kmahone commented 4 years ago

I've filed a separate issue for the 'CalendarDatePickerTopHeaderMargin' issue:

2719 RS4 and lower: Cannot find a Resource with the Name/Key CalendarDatePickerTopHeaderMargin

Fixing this in WinUI should be pretty straight forward.

If you want to work-around this issue in your app until we have a release out containing the fix, it should be easy. Just add this Xaml to your App.xaml: <Thickness x:Key="CalendarDatePickerTopHeaderMargin">0,0,0,4</Thickness>

The cause of the other issues is still unclear.

In AppCenter, do you have the ability to see the full call stack of the crash? Or do you just see the error message? (I've personally never used AppCenter).

tipa commented 4 years ago

Thanks! The stack traces unfortunately seem to not contain a lot of information: image

Also found yet another crash report: Windows.UI.Xaml.Markup.XamlParseException: Não foi possível encontrar o texto associado a este código de erro. Cannot create instance of type 'Microsoft.Graphics.Canvas.UI.Xaml.CanvasControl' [Line: 0 Position: 0]

gascardi commented 3 years ago

@kmahone The app I work on also logs crashes in several OS Versions (10.0.17763, 10.0.18363, 10.0.19041, and more) with no other details and no local repro.

errorCode exceptionType exceptionMessage exceptionStackTrace
-2144665590 XamlParseException The text associated with this error code could not be found. Cannot create instance of type 'Microsoft.UI.Xaml.Controls.XamlControlsResources' [Line: 0 Position: 0]
tipa commented 3 years ago

After all those months this crash is still visible in my AppCenter crash reports.

Windows.UI.Xaml.Markup.XamlParseException: De tekst die bij deze foutcode hoort, kan niet worden gevonden. Cannot create instance of type 'Microsoft.UI.Xaml.Controls.XamlControlsResources' [Line: 0 Position: 0]

StephenLPeters commented 3 years ago

@RealTommyKlein FYI

tipa commented 2 years ago

Will this ever be fixed? 🤔 My AppCenter crash reporting is flooded with these crashes

image

evelynwu-msft commented 1 year ago

Will this ever be fixed? 🤔 My AppCenter crash reporting is flooded with these crashes

Mitigations and auto-healing logic were added to the package deployment stack in early 2021 and backported all the way to 10.0.18362 that should help machines recover from this bad state. Unfortunately, as you've probably surmised, this doesn't fully prevent machines from entering this bad state in the first place so it's likely that you'll continue to see AppCenter crash reports of this nature, just hopefully not from the same devices if they're on 18362 or later. Work is ongoing to investigate and fix all potential root causes but progress has been slow because this is a complex area and reproducing the issue is difficult. I'm sorry I don't have better news for you right now but I wanted to provided you with an update.

tipa commented 1 year ago

@evelynwu-msft Thanks for the update. I still see devices with recent Windows installations (e.g. 10.0.19043) which crash multiple times (50times and more), so they don't seem to auto-recover from this bad state.

tipa commented 1 year ago

Bumping this (see https://github.com/microsoft/microsoft-ui-xaml/discussions/8638).