Open mqudsi opened 3 years ago
The downstream cause is a XamlParseException
in MainWindow
's InitialComponent()
with the following stack trace:
Microsoft.UI.Xaml.Markup.XamlParseException: XAML parsing failed.
at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr) in WinRT.Runtime.dll:token 0x60003cd+0x1c
at ABI.Microsoft.UI.Xaml.IApplicationStatics.global::Microsoft.UI.Xaml.IApplicationStatics.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation) in Microsoft.WinUI.dll:token 0x600159a+0x47
at Microsoft.UI.Xaml.Application.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation) in Microsoft.WinUI.dll:token 0x600ae88+0x0
at PrayerGuardian.MainWindow.InitializeComponent() in PrayerGuardian.dll:token 0x60000af+0x1b
at PrayerGuardian.MainWindow..ctor() in PrayerGuardian.dll:token 0x60000ab+0x10
The internal message is
Cannot locate resource from 'ms-appx:///MainWindow.xaml'.
This happens even with a new blank desktop window template (BlankWindow1) used instead of my existing MainWindow : Window
instance (which only contains a single <Frame />
element, anyway).
No Window
methods are overridden, there's no Activated
handler (and even if there were, it wouldn't have been installed yet at this point). The MainWindow
instance is initialized in override OnLaunched
in App.xaml.cs
:
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
MainWindow = new MainWindow();
MainWindow.Activate();
}
but since it is terminating in the new MainWindow()
call, MainWindow.Activate()
is not even being reached.
The App.xaml
contents are similarly non-descript:
<Application
x:Class="PrayerGuardian.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PrayerGuardian">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
Again, this only happens on any other machine besides mine - locally, it runs flawlessly. The application is always packaged and deployed via the MSIX side load installer. The application was created under 18363 with Visual Studio 2019 16.11.0 Preview 3.0.
These are the stowed exceptions:
Stowed Exception Array @ 0x000001d2f8863300
Stowed Exception #1 @ 0x000001d2f8882d00
0x802B000A (FACILITY_XAML - XAML): Unknown Error
Stack : 0x1d2f8881018
7fff623ac024 Microsoft_UI_Xaml!DirectUI::FrameworkApplicationGenerated::OnLaunchedProtected+0x16ed20
7fff6223d2b3 Microsoft_UI_Xaml!DirectUI::FrameworkApplication::InvokeOnLaunchActivated+0xe7
7fff6220a190 Microsoft_UI_Xaml!DirectUI::FrameworkApplication::StartOnCurrentThreadImpl+0x124
7fff62209cd6 Microsoft_UI_Xaml!DirectUI::FrameworkApplicationGenerated::StartOnCurrentThread+0x26
7fff6213db63 Microsoft_UI_Xaml!DirectUI::WindowsXamlManager::XamlCore::Initialize+0xef
7fff6213e7c8 Microsoft_UI_Xaml!DirectUI::WindowsXamlManager::Initialize+0xa8
7fff620edb13 Microsoft_UI_Xaml!ctl::ComObjectBase::CreateInstanceBase+0x13
7fff622a961d Microsoft_UI_Xaml!ctl::make<DirectUI::WindowsXamlManager>+0x4d
7fff622a9569 Microsoft_UI_Xaml!DirectUI::WindowsXamlManagerFactory::InitializeForCurrentThreadImpl+0x21
7fff622a9527 Microsoft_UI_Xaml!DirectUI::WindowsXamlManagerFactory::InitializeForCurrentThread+0x27
7fff62209f2d Microsoft_UI_Xaml!DirectUI::FrameworkApplication::StartDesktop+0x169
7fff62209d63 Microsoft_UI_Xaml!DirectUI::FrameworkApplicationFactory::Start+0x63
7fff04f346dd
Stowed Exception #2 @ 0x000001d2f88786a0
0x80004005 (FACILITY_NULL - Default): E_FAIL - Unspecified failure
Stack : 0x1d2f88769b8
7fff62384215 Microsoft_UI_Xaml!CCoreServices::LoadXamlResource+0x1a2555
7fff621cf657 Microsoft_UI_Xaml!CApplication::LoadComponent+0x16b
7fff621bf030 Microsoft_UI_Xaml!Application_LoadComponent+0xa4
7fff621bed62 Microsoft_UI_Xaml!DirectUI::FrameworkApplication::LoadComponent+0xde
7fff621bec55 Microsoft_UI_Xaml!DirectUI::FrameworkApplicationFactory::LoadComponentWithResourceLocationImpl+0x7d
7fff621bebaa Microsoft_UI_Xaml!DirectUI::FrameworkApplicationFactory::LoadComponentWithResourceLocation+0x4a
7fff051481fa
(Sidenote, instructions on accessing stowed exceptions could use some work. !pde.dse
requires a memory address, but it's not the address of the thrown c000027b exception. I ended up using !dpx -dse
to get the stowed exceptions and their addresses, then inspecting those addresses with !pde.dse <addr>
)
There seems to be something wrong with how the XAML resources are being packaged - the crash is not machine-dependent at all, but rather dependent on the method of deployment. When the Package project is deployed via Visual Studio and the resulting app is installed out of the bin/[Debug|Release]
folder, everything works fine. When the package is published as a .msixbundle
and that MSIX is installed/deployed, the application crashes at startup when it fails to load resources from ms-appx:///MainWindow.xaml
.
I've updated the initial post accordingly.
resources.pri
does not include any of the compiled xaml .xbf
resources for apps suffering from this.
The problem is that Prep_ComputeProcessXamlFiles
does not run because '@(ApplicationDefinition)'!='' or '@(Page)'!=''
does not evaluate to true (App.xaml
correctly has its compile property set to "Application Definition" and MainWindow.xaml
has its compile property set to "Page" - don't go chasing after them, red herring, wrong tree, yada yada.)
This occurs if ProjectReunion.WinUi
is installed as a transitive dependency - it must (also) be directly referenced in the project.
The tooling surrounding WinUI is extremely fragile, emits terribly opaque errors, and is not well documented. Hopefully this helps someone.
@drustheaxe FYI
This occurs if ProjectReunion.WinUi is installed as a transitive dependency
This sounds like the Universal Windows / ...Transitive... issue that plagued MrtCoreManagedTest last week.
@Scottj1s any thoughts? You're more the VS-project-Jedi-master than I ;-)
@DrusTheAxe I think when I was browsing some of the older WindowsAppSDK issues a couple of weeks ago IIRC you were bringing up tooling concerns regarding shipping WinUI and WindowsAppSDK only via NuGet to start. Presumably this is something else you can add to the list of concerns if you ever wanted to ship them as vcpkg dependencies, since the nuget package is doing more than just pulling in some libraries here.
@llongley @DrusTheAxe's decriptions sounds similar to the issue we had with Winui2 being included transitively. Ring any bells?
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Bump.
Bump here too Seems to have only started happening recently
Describe the bug
My WinUI3 project built against Project Reunion 0.8.2 is crashing on startup when deployed via the MS Store or via a published side loading
.msixbundle
file. It runs fine if deployed exploded via Visual Studio directly from the Debug/Release folder.The error message from the minidump:
The stack trace is not very helpful:
and an alternate stack trace from WinDbg:
with the following details:
Steps to reproduce the bug
Unknown
Version Info
NuGet package version:
WinUI 3 - Project Reunion 0.8:
[0.8.2]
Additional context
A
XamlParseException
is thrown at startup when the package is deployed via an msixbundle rather than run from the exploded bin folder.