teamsiso/docs/archive/TeamsISO.App.WinUI.Probe/TeamsISO.App.WinUI.Probe.csproj

50 lines
1.9 KiB
XML
Raw Normal View History

build(winui3): switch to WindowsAppSDK 1.8 + add diagnostic probe Two big findings from a custom MddBootstrapInitialize2 P/Invoke probe this session: 1. The original WinUI 3 activation failure ("this application could not be started") was MDD_E_BOOTSTRAP_INITIALIZE_DDLM_NOT_FOUND (HR 0x80670016). The framework package Microsoft.WindowsAppRuntime.1.6 was installed, but the Dynamic Dependency Lifetime Manager sibling (MicrosoftCorporationII.WinAppRuntime.Main.1.6) wasn't. This machine has Main.1.5 and Main.1.8 packages but no Main.1.6, so bootstrap for 1.6 fails. 2. Switching the WindowsAppSDK NuGet to 1.8.250916003 + the bootstrap major.minor to 0x00010008 in Program.cs gets past activation. The .exe now launches and Bootstrap.TryInitialize returns S_OK. The 1.8 DDLM is present and the runtime spins up. Also lands `src/TeamsISO.App.WinUI.Probe/`, a tiny console diagnostic that calls MddBootstrapInitialize2 directly via P/Invoke (bypassing the full WindowsAppSDK NuGet to avoid the MRT/PRI MSBuild tasks that need VS's AppxPackage tooling installed). The probe prints the HResult and a human-readable description; use it to triage WindowsAppSDK activation on any deployment target: dotnet run --project src/TeamsISO.App.WinUI.Probe A SECOND ISSUE surfaces after activation: the .exe crashes 1 second after launch with 0xC000027B inside Microsoft.UI.Xaml.dll, sub-code 0x802b000a (XAML_E_PARSER_GENERAL_ERROR). The participants ItemsRepeater with {Binding ...} markup is suspect (WinUI 3 prefers x:Bind with x:DataType, and Visibility="{Binding bool}" needs a converter). The ItemsRepeater is stubbed out to a plain "Participants list renders here" TextBlock placeholder for now; same crash recurs, so the XAML issue is elsewhere — likely in Controls.xaml (one of CharacterSpacing / TextCaption / etc. unsupported), in App.xaml's MergedDictionary chain, or in MainWindow.xaml's Storyboard target. Triaging the XAML parse error is the next session's first action. The sub-code 0x802b000a will help (search WindowsAppSDK source for the matching XAML parser error). The migration plan in docs/superpowers/plans/2026-05-12-winui3-migration.md is updated. Build remains clean.
2026-05-13 00:39:43 -04:00
<Project Sdk="Microsoft.NET.Sdk">
<!--
Tiny diagnostic console app for the WinUI 3 activation blocker.
Calls the native MddBootstrapInitialize2 export from
Microsoft.WindowsAppRuntime.Bootstrap.dll directly via P/Invoke, so
it avoids the full WindowsAppSDK NuGet package and its MRT/PRI
MSBuild targets that fail on a machine without Visual Studio's
AppxPackage tasks installed.
Build: dotnet build src/TeamsISO.App.WinUI.Probe
Run: ./src/TeamsISO.App.WinUI.Probe/bin/Debug/net8.0-windows/win-x64/TeamsISO.App.WinUI.Probe.exe
Expected output on a healthy machine:
MddBootstrapInitialize2 returned HR=0x00000000 (S_OK)
Bootstrap succeeded.
On a machine where Microsoft.WindowsAppRuntime.Bootstrap.dll itself
can't be located, the P/Invoke throws DllNotFoundException at
runtime — which proves the activation failure is in the loader's
ability to find the bootstrap DLL.
-->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>TeamsISO.App.WinUI.Probe</RootNamespace>
<Platforms>x64</Platforms>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<!--
Hand-copy Microsoft.WindowsAppRuntime.Bootstrap.dll from the
NuGet cache so the P/Invoke can find it. Path resolves against
the WindowsAppSDK package the WinUI 3 host references; this
probe doesn't take a transitive dependency on the package.
-->
<Content Include="$(NuGetPackageRoot)microsoft.windowsappsdk\1.6.250602001\runtimes\win-x64\native\Microsoft.WindowsAppRuntime.Bootstrap.dll"
Link="Microsoft.WindowsAppRuntime.Bootstrap.dll"
CopyToOutputDirectory="PreserveNewest"
Visible="false" />
</ItemGroup>
</Project>