I upgraded my code to .NET 9. After the upgrade, I am getting undefined symbol error:
wasm-ld : error : lto.tmp: undefined symbol: gprsharp_convert_clock_type [C:\dev\mymachine\build\ABv5P3KR\0\my-project\myprojectcode\src\MyModules\Module1\MyProject1.csproj]
This happens in the release build.
I set the flag WasmAllowUndefinedSymbols
in BrowserWasmApp.targets
file to true (the original value was false) and the code was built successfully with warnings. I don't understand why it fails when it is false after .NET 9 upgrade.
<WasmAllowUndefinedSymbols Condition="'$(WasmAllowUndefinedSymbols)' == ''">false</WasmAllowUndefinedSymbols>
I had this same issue when upgrading our Blazor WASM site from .NET 8 to .NET 9.
The key issue turned out to be somewhere inside the whole protobuf/grpc stack.
The problem package is Grpc.Core
which is no longer maintained
You need to either remove your direct package reference (if you have one).
More likely its a downstream reference, which you can check using the .NET cli
dotnet nuget why .\YourSolutionFile.sln Grpc.Core
In our case it was the third party package PatrickJahr.Blazor.GrpcWeb.DevTools
If you are using the same problem package, I created a fork that fixes the .NET 9 build (as well as preserving original exceptions).
p.s. I was originally tipped off from this GitHub comment