runtime: Dotnet native compiled js file referencing wrong function in blazor web assembly file

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

My team have been reliant on the blazor-error-ui banner for when we have errors we need to check and after upgrading our project from dotnet 7 to dotnet 8 and updating our packages, we have noticed the banner doesn’t show up as often as we want it to.

Delving deeper and running the project, I noticed that within the compiled dotnet native file, dotnet.native.8.0.3.9nm7bajy7e.js, there were references to functions within the compiled blazor web assembly, blazor.webassembly.js. The references is

var out = **Module["print"]** || console.log.bind(console);
var err = **Module["printErr"]** || console.warn.bind(console);

However, checking the blazor wasm file, I couldn’t find those functions. Checking through the same on the dotnet 7 version of our project, I found those functions which the names print and printErr.

After some cross checking, I found out that the names of those functions on dotnet 8 had change to out and err.

FYI These are the package references we have for WebAssembly in our project on dotnet 8:

<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" /

Expected Behavior

The error and out functions should point to the correct functions

Steps To Reproduce

Run any Blazor Client project on dotnet 8 with the aim of generating an unhandled error. It shouldn’t show up if the error banner is enabled.

Exceptions (if any)

No response

.NET Version

dotnet 8

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (13 by maintainers)

Most upvoted comments

Fixed by https://github.com/dotnet/runtime/pull/100818 for next Net8 servicing release

@pavelsavara Well, that makes sense but not all errors corrupt programs though.

Some assert happened in your native code (or in Mono code) and called abort(). There is no class of “harmless” asserts or aborts. If you want to recover from such problem, I suggest that you reload the whole page.