sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Move the Blazor WebAssembly sample off the deprecated DevServer

Open ric-oliv opened this issue 3 weeks ago • 1 comments

dotnet/aspnetcore#67857 deprecated Microsoft.AspNetCore.Components.WebAssembly.DevServer in .NET 11 and replaced it with Microsoft.AspNetCore.Components.Gateway. The 11.0.0 package says so on nuget.org, and DevServer logs this at startup:

Microsoft.AspNetCore.Components.WebAssembly.DevServer is deprecated and will be removed in a future release. Use Microsoft.AspNetCore.Components.Gateway instead.

samples/Sentry.Samples.AspNetCore.Blazor.Wasm still uses it. People copy our samples, so I'd like to move it to Gateway the same way the .NET 11 blazorwasm template does:

  • Swap the DevServer PackageReference for Gateway, keeping PrivateAssets="all".
  • Set StaticWebAssetSpaFallbackEnabled to true. Without it, Gateway returns 404 for every page, including /.
  • Drop the inspectUri entries from launchSettings.json. They only serve the legacy in-browser debugging that dotnet/aspnetcore#67858 obsoleted, and IDEs start the debug proxy themselves.

I've tried this locally on macOS. All three sample pages load, deep links work, and the SDK initializes the same way it does with DevServer. The published output doesn't change, because neither server gets deployed.

Two things to keep in mind:

  • The fallback property and the package swap need to land together. With the property set, DevServer finds two fallback routes and returns a 500 to any client that doesn't accept gzip. Browsers do accept it, so it's easy to miss.
  • The template no longer has an IIS Express profile, and I can't test ours on a Mac. I'd remove it too, unless someone on Windows wants to check that it still works with Gateway.

#5902 also bumps this sample's DevServer pin to 11.0.0, so whichever PR lands second needs a small rebase. The Playwright test app targets net10.0 with DevServer 10.0.0, which isn't deprecated, so it stays as it is.

ric-oliv avatar Nov 10 '26 21:11 ric-oliv

NET-919

linear-code[bot] avatar Nov 10 '26 21:11 linear-code[bot]