Skip to content

Dotnet native compiled js file referencing wrong function in blazor web assembly file #100591

Closed
@Victorolu

Description

@Victorolu

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions