Repository navigation
fix(sdk): Move WebGPU usage detection into Uno.Sdk - #25580
Conversation
Packaging rewrites "v0" to the commit in the files under src/Uno.Sdk, which renames both the task classes and Uno.Sdk_v0.dll. The WebGpu package registered and called DetectWebGpuUsage_v0 from its own targets, outside that rewrite, so a packed SDK no longer had a task by that name and every app naming the webgpu feature failed with MSB4062. The registration and the target that runs the task now live in the SDK, next to the assembly they name, and are rewritten with it. The package opts in with _UnoWebGpuNativeTrim and keeps only the targets that drop the native payload. Against an SDK without the detection nothing sets _UnoWebGpuNativeUnused, so the payload is kept. Fixes unoplatform#25336 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
|
There was a problem hiding this comment.
Non-blocking notes:
-
CI doesn't test this fix.
run-netcore-mobile-template-tests.ps1already has theSkia;WebGpucases that would have caught the bug, but their job in.azure-devops-tests-templates.ymliscondition: false. In-repo builds use the un-rewritten_v0names, so nothing in CI runs the packed path. A small follow-up check would help: flag any_v0reference in files that_Sha1Replacedoesn't cover. That's the same class of bug. -
The validation only covered keeping the payload. Chefs references the backend, so the log shows "Keeping the wgpu native payload". Dropping the payload (
_UnoWebGpuNativeUnused=true, then the files are removed) wasn't run against a SHA-rewritten SDK. The risk is low since the logic moved verbatim. Still, askia;webgpuapp that never touches the backend should log "…payload is omitted" and ship nowebgpu.dll. -
The description overstates "older package, new SDK". The old package still defines
_UnoWebGpuDetectUsage, and since it's imported later, its definition silently overrides the SDK's. So the override decides the outcome, not the missing opt-in property. That path also still fails with MSB4062 against a rewritten SDK. "Behaves as it does today" is accurate, but "fail safe" isn't. -
Nit:
UnoSdkTasksAssemblyis now only used inside the SDK. It was added so packages could find the SDK DLL, which is the pattern that caused this bug. The other SDK registrations (Uno.AppLaunch.targets,Uno.Implicit.Packages.targets) use$(MSBuildThisFileDirectory)netstandard2.0\Uno.Sdk_v0.dlldirectly. Switching to the direct path and dropping or underscoring the property would discourage the next package from relying on it. TheExists()checks also turn a missing DLL into a silent skip that keeps the payload, rather than an error that would expose a packing bug. -
Nit: the 15-line comment block in
Uno.WebGpu.targetsis long for repo style. It mostly carries the old rationale over, so it's fine either way.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
The task now loads from the sdk's own assembly path, like the other sdk task registrations, instead of an UnoSdkTasksAssembly property that packages could rely on. A missing assembly is now a build error rather than a silent skip. Packaging also fails when a packaged MSBuild file outside _Sha1Replace still names _v0, the class of bug behind unoplatform#25336. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Thanks, addressed in 895f389:
|
The repo imports Uno.Sdk from source, where no task assembly sits beside the targets, so the now-mandatory detection task failed to load (MSB4062) in the SamplesApp wasm head. A repo head always reaches WebGPU, so there is nothing to trim there. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
|
|
dev.89 ships the WebGPU usage detection inside Uno.Sdk (unoplatform/uno#25580), so builds with the WebGpu feature no longer fail with MSB4062 on DetectWebGpuUsage_v0, and it pins the Toolkit 11 / Extensions 8 builds that match Uno 7. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
GitHub Issue: closes #25336
PR Type:
🐞 Bugfix
What changed? 🚀
Any app that names the
webgpufeature against a CI-builtUno.Sdkfails with:Packaging (
UpdateTasksSHA) rewritesv0to the commit in every file undersrc/Uno.Sdk. That renames both the task classes andUno.Sdk_v0.dll. The WebGpu package registered and calledDetectWebGpuUsage_v0from its ownNativeTrim.targets, outside that rewrite. So it pointed at the rewritten assembly by a class name that no longer exists.This PR moves the
UsingTaskand the_UnoWebGpuDetectUsagetarget into a newsrc/Uno.Sdk/targets/Uno.WebGpu.targets, imported bySdk.targets. They're now rewritten together with the assembly they name, like every other SDK task._UnoWebGpuNativeTrim, which keeps today's behaviour: detection runs whenever the package's targets are imported._UnoWebGpuDetectUsageorILLink, unchanged.The SDK registers the task from its own path (
$(MSBuildThisFileDirectory)netstandard2.0\Uno.Sdk_v0.dll), likeUno.AppLaunch.targetsandUno.Implicit.Packages.targets. TheUnoSdkTasksAssemblyproperty is removed, so no package can point at the SDK's assembly again. A missing assembly is now a build error rather than a silent skip.Packaging now also fails if a packaged MSBuild file outside
_Sha1Replacenames a_v0symbol. That coversbuild/nuget, and everybuildTransitiveandpackagefolder undersrc, which is the class of bug behind #25336.Mixed versions:
_UnoWebGpuNativeUnusedis never set and the wgpu payload is kept._UnoWebGpuDetectUsage, and since it's imported later, its definition overrides the SDK's. That target is gated onUnoSdkTasksAssembly, which this SDK no longer sets, so it skips, and the payload is kept with no MSB4062.Validation
Against a locally packed
Uno.Sdkwithv0rewritten byUpdateTasksSHA(a probenet10.0-desktopapp withUnoFeaturesSkia;WebGpu):webgpu.dll/libwebgpu.*in the output7.0.0-dev.2420The renamed
DetectWebGpuUsage_<sha>loaded fromUno.Sdk_<sha>.dll.Earlier, using Uno Chefs (
skia;webgpu) against the published SHA-rewrittenUno.Sdk 7.0.0-dev.81andUno.WinUI.Composition.WebGpu 7.0.0-dev.2347:Uno.WinUI.Composition.WebGpu.NativeTrim.targets(30,3), reproducing the issue.The
_v0packaging check fails on a planted_v0reference and passes on this branch.The detection logic moved verbatim, apart from the opt-in condition.
Not covered by CI: the
Skia;WebGpucases inrun-netcore-mobile-template-tests.ps1would exercise the packed path, but their job in.azure-devops-tests-templates.ymliscondition: false. Re-enabling it is a separate change.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code