ada-blazor-wasm-runtime-pitfalls

Diagnose and fix Blazor WASM runtime state, navigation, interop, and native-linking failures.

Updated Jul 23, 2026
One-click install
npx skills add https://github.com/wubing7755/Ada --skill ada-blazor-wasm-runtime-pitfalls-wubing7755
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ada-blazor-wasm-runtime-pitfalls
Source: https://github.com/wubing7755/Ada/tree/main/skills/software-development/ada-blazor-wasm-runtime-pitfalls
Command: npx skills add https://github.com/wubing7755/Ada --skill ada-blazor-wasm-runtime-pitfalls-wubing7755

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Blazor WebAssembly apps fail in ways that produce no exceptions: first-render JS interop silently no-ops, URL fragments vanish on direct load, query-only navigation leaves stale components, and native libraries throw DllNotFoundException only under Visual Studio builds. This Skill provides verified root causes and fixes for these production pitfalls. ## Core Features & Use Cases - Runtime state and navigation fixes: data-ready gates for first-render interop, JS-based fragment reading, LocationChanged subscriptions for query-only navigation, and one-shot flag reset patterns. - Fault isolation and content loading: per-section fault boundaries, latest-request commit gates, and offline-enrichment debugging for sort/count features. - Native library linking diagnostics: an evidence ladder for DllNotFoundException (served dotnet.wasm inspection, CLI vs VS build comparison, workload SDK imports) plus a verification script. - Use Case: A developer's Blazor WASM site on GitHub Pages fails to scroll to /#latest on direct load and the footer back-to-top link jumps to the homepage; the Skill explains the fragment-drop and base-href root causes and provides the JS interop fix. ## Quick Start Ask the agent why a Blazor WASM fragment scroll or JS interop call silently fails on first render and apply the verified fix pattern it returns.

Frequently Asked Questions about ada-blazor-wasm-runtime-pitfalls

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does Blazor WASM JS interop do nothing on first render?

On WASM startup, OnAfterRenderAsync can fire before JS interop is reliably ready, so the call silently no-ops with no exception. Gate the call on a data-loaded flag instead of firstRender so it executes on a later render when interop is ready.

How do I fix Blazor WASM fragment scrolling on direct page load?

Blazor WASM initialization can drop the URL fragment, so NavigationManager.Uri.Fragment reads empty on initial load. Read window.location.hash through a small JS interop helper and scroll with scrollIntoView instead of relying on NavigationManager.

Why does Blazor WASM throw DllNotFoundException for libSkiaSharp?

In .NET 6, native libraries must be linked into dotnet.wasm at build time via WasmBuildNative and the WebAssembly workload SDK. Visual Studio builds can silently skip the link and copy the small runtime-pack dotnet.wasm; check the served wwwroot/_framework/dotnet.wasm size and symbols first.

Why does changing only the query string not refresh my Blazor page?

Blazor reuses the routable component instance for same-route query-only navigation, so OnInitializedAsync never re-runs. Subscribe to NavigationManager.LocationChanged and re-parse Navigation.Uri, or use SupplyParameterFromQuery with OnParametersSetAsync.

Should I deploy Blazor WASM Build output or Publish output?

Always deploy the Publish output from dotnet publish. The Build output's wwwroot lacks the _content folder with NuGet package static assets, so copied sites load with missing CSS and JS while local dotnet run looks fine.

When should I avoid native libraries like SkiaSharp in Blazor WASM?

For simple countable shapes with hit-testing, browser-native SVG with @onclick handlers avoids the entire native-linking problem class and the roughly 20MB dotnet.wasm. Reserve native libraries for complex rendering such as paths, gradients, and image operations.