Skip to content

Commit 2c6819d

Browse files
MartinZikmundclaude
authored andcommitted
Fix WASM gallery startup (splash stall / blank) by forcing UnoRuntimeIdentifier
The WASM head sets TargetFramework late, via App.Head.Wasm.props imported in the project body, after NuGet's generated .nuget.g.props has already been evaluated. That generated file imports Uno.(UI|WinUI).Runtime.WebAssembly.props - which sets UnoRuntimeIdentifier=WebAssembly - inside an ImportGroup gated on "'$(TargetFramework)' == 'net9.0'". Since TargetFramework is still empty when .nuget.g.props is evaluated, the import is skipped and UnoRuntimeIdentifier is never set. With UnoRuntimeIdentifier empty, Uno's ReplaceUnoRuntime target (gated on UnoRuntimeIdentifier != '') does not run, so the platform-agnostic reference Uno.UI.dll (lib/, no embedded JS) is deployed instead of the uno-runtime/.../webassembly implementation that embeds Uno.UI.WasmScripts.Uno.UI.js. The bootstrapper therefore has no Uno runtime JS to load, globalThis.Uno.UI is never registered, Application.Start's callback is never invoked, and the gallery hangs on the splash screen (WinUI 2 / Uno.UI) or shows blank (WinUI 3 / Uno.WinUI). This regressed in the net8 -> net9 migration that flipped the head SDK from Microsoft.NET.Sdk.Web to Microsoft.NET.Sdk.WebAssembly. Set UnoRuntimeIdentifier=WebAssembly and UnoIsWebAssemblyBrowserHead=true explicitly in App.Head.Wasm.props so the runtime-assembly swap runs regardless of NuGet import timing. Verified end-to-end (gallery renders, 2386 XAML elements) for both Uno.UI/WinUI 2 and Uno.WinUI/WinUI 3. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 371e96e commit 2c6819d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎ProjectHeads/App.Head.Wasm.props‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
<TargetFramework>$(WasmHeadTargetFramework.Split(';')[0])</TargetFramework>
55
</PropertyGroup>
66

7+
<!--
8+
TargetFramework is set late (above), so NuGet's net9.0-conditional import of
9+
Uno.*.Runtime.WebAssembly.props is skipped and UnoRuntimeIdentifier never gets set. Without it
10+
Uno deploys the reference Uno.UI.dll (no embedded JS) instead of the WebAssembly runtime build,
11+
so the app stalls on the splash. Set it explicitly so the runtime-assembly swap runs.
12+
-->
13+
<PropertyGroup>
14+
<UnoRuntimeIdentifier>WebAssembly</UnoRuntimeIdentifier>
15+
<UnoIsWebAssemblyBrowserHead>true</UnoIsWebAssemblyBrowserHead>
16+
</PropertyGroup>
17+
718
<Import Project="$(MSBuildThisFileDirectory)\App.Head.Uno.props" />
819

920
<PropertyGroup Condition="'$(Configuration)'=='Release'">

0 commit comments

Comments
 (0)