Repository navigation
Description
Current behavior 🐛
Adding the WebGpu feature to UnoFeatures fails the build when the Uno.Sdk comes from a CI-built package (such as a locally built or dev-feed Uno.Sdk):
error MSB4062: The "Uno.Sdk.Tasks.DetectWebGpuUsage_v0" task could not be loaded from the assembly ...\Uno.Sdk_<commit-sha>.dll.
The failing target is _UnoWebGpuDetectUsage in Uno.WinUI.Composition.WebGpu.NativeTrim.targets.
Expected behavior 🎯
The task resolves and the build succeeds, as for the other Uno.Sdk tasks.
How to reproduce it (as minimally and precisely as possible) 🔬
Confirmed by code inspection of the build scripts; the failure itself was observed with a locally built Uno.Sdk package.
- Build the Uno.Sdk and
Uno.WinUI.Composition.WebGpupackages through the repo's package build (build/Uno.UI.Build.csproj, which runs theUpdateTasksSHAtarget). - Create an app that consumes them and set
<UnoFeatures>...;Skia;WebGpu;</UnoFeatures>. - Build the app.
Workaround
Redefine an empty _UnoWebGpuDetectUsage target in Directory.Build.targets. The wgpu native payload is then always kept (no trimming), and both the Skia and WebGPU backends run.
Root cause
- Task classes and the SDK assembly are versioned with a
_v0suffix.UpdateTasksSHAreplaces the textv0with the commit SHA in a fixed list of files, which includessrc\Uno.Sdk\**\*(Uno.UI.Build.csproj#L46-L72). This turnsDetectWebGpuUsage_v0intoDetectWebGpuUsage_<sha>andUno.Sdk_v0.dllintoUno.Sdk_<sha>.dll. - The
UsingTaskfor the WebGPU detection task lives outside that list, in the WebGpu package: Uno.WinUI.Composition.WebGpu.NativeTrim.targets#L16. It keeps the literalUno.Sdk.Tasks.DetectWebGpuUsage_v0and pointsAssemblyFileat$(UnoSdkTasksAssembly)(Uno.Common.targets#L5), which does get rewritten and exists. TheExists()guard therefore passes, the class name never matches, and the task fails to load. - Every other task registration (
Uno.AppLaunch.targets,Uno.Implicit.Packages.targets) sits undersrc/Uno.Sdkand is rewritten together with its class.
UpdateTasksSHA runs unconditionally from PrepareBuildAssets, so I expect any CI-built Uno.Sdk to hit this, not only local builds. Only a build straight from a source checkout (no SHA replacement) would not.
Suggested fix
Either add the NativeTrim targets file to _Sha1Replace in build/Uno.UI.Build.csproj, or move the UsingTask into a targets file under src/Uno.Sdk so it is rewritten together with the class.
Works on UWP/WinUI
N/A (Uno.Sdk build infrastructure).
Environment
Uno.Sdk built from the repo (7.0.0-dev), net10.0-desktop, .NET SDK 10.0.400. Source inspected at 0599dad.
Affected platforms
Any head that names WebGpu (observed on Skia desktop).
Activity
fix(sdk): Register WebGPU detection from the sdk's own path
ci(canary): Add the WebGPU canary
fix(sdk): Move WebGPU usage detection into Uno.Sdk