We ran into an interesting issue after installing .NET 9 SDK 9.0.204 (and 9.0.300 didn’t help either) with published Blazor WebAssembly front-ends. The app failed to load, and the browser console output showed this error:
ManagedError: AggregateException_ctor_DefaultMessage (Could not resolve type with token 01000024 from typeref (expected class 'System.Reflection.Assembly' in assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'))
at an (dotnet.runtime.5nhp1wfg9b.js:3:26894)
at Kt.resolve_or_reject (dotnet.runtime.5nhp1wfg9b.js:3:26449)
at dotnet.runtime.5nhp1wfg9b.js:3:172714
at dotnet.runtime.5nhp1wfg9b.js:3:172778
at fr (dotnet.runtime.5nhp1wfg9b.js:3:35046)
at Fc (dotnet.runtime.5nhp1wfg9b.js:3:172361)
at dotnet.native.swgexbmoy7.wasm:0x1f1a4
at dotnet.native.swgexbmoy7.wasm:0x1c8ae
at dotnet.native.swgexbmoy7.wasm:0xea19
at dotnet.native.swgexbmoy7.wasm:0x1ec88
Our first suspicion was trimming, but to make a long story short, this turned out to be the classic issue that comes with builds after installing a new SDK: you need to clear the build agents’ working folders if your builds don’t run in completely clean environments and rely on any kind of incremental setup.
Translated to local development in Visual Studio: make sure to clean the solution and manually delete the bin and obj folders.
Why am I posting this? In case someone else runs into the same error, maybe they’ll find this post and save time troubleshooting. We’ve pretty much gotten used to builds breaking after a new SDK install, and our go-to move is wiping the build agent workspace before diving deeper.
But this was a first for us: the build actually succeeded, but the output was “broken” in a way that only surfaced when running the Blazor WASM frontend in the browser.