-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Is there an existing issue for this?
- I have searched the existing issues
Description
After upgrading from ABP 9.3.3 to ABP 10.0.0 (.NET 10), the Blazor WebAssembly project fails to start because dotnet.js cannot be found. The global.js file generated by abp bundle command contains an incorrect relative path.
Error message:
Failed to start platform. Reason: TypeError: Failed to fetch dynamically imported module: https://localhost:44307/dotnet.js
Problem Details
The global.js file generated by the abp bundle command has a different path for loading dotnet.js.
global.js in ABP 9.3.3 / .NET 9 (Working):
let t = "_framework/dotnet.js";
// ...
const n = new URL(t, document.baseURI).toString();
return await import(n)
global.js in ABP 10.0.1 / .NET 10 (Broken):
return await import("./dotnet.js")
Root Cause
The global.js bundle includes content from blazor.webassembly.js. In .NET 10, the blazor.webassembly.js changed to use a relative path ("./dotnet.js") instead of the explicit "_framework/dotnet.js" path.
This works when blazor.webassembly.js is located inside _framework folder, but ABP's bundle mechanism places global.js in the root wwwroot directory, not in _framework.
Reproduction Steps
- Take an existing Blazor WebAssembly (Standalone) project created with ABP 5, 6, 7 (the original standalone WASM project structure with index.html)
- Upgrade to ABP 10.0.1 + .NET 10 (From ABP 9.x)
- Run abp bundle command
- Start the project (dotnet run)
- Open browser console - you will see the dotnet.js not found error
Expected behavior
The abp bundle command should generate global.js with the correct path for dotnet.js. Since global.js is placed in the root wwwroot directory, it should use "_framework/dotnet.js" or calculate the absolute path using new URL() as it was done in previous versions.
Actual behavior
No response
Regression?
No response
Known Workarounds
Workaround 1: Manually fix the path in global.js
Manually modify global.js after running abp bundle:
Find:
return await import("./dotnet.js")
Replace with:
return await import("_framework/dotnet.js")
Result: This partially works - the DLL/WASM files are loaded and the initial page appears, but then the application crashes with multiple errors:
dotnet.js:4 Uncaught (in promise) Error: Assert failed: .NET runtime already exited with 1
Error: Assert failed: .NET runtime already exited with 1 [object Object].
You can use runtime.runMain() which doesn't exit the runtime.
at Be (dotnet.js:4:22402)
at Object.He [as assert_runtime_running] (dotnet.js:4:22546)
at Object.<anonymous> (invoke-cs.ts:140:23)
at Object.endInvokeJSFromDotNet (global.js:1:46844)
at w.beginInvokeJSFromDotNet (global.js:1:4330)
Workaround 2: Copy dotnet.js to root
Copying dotnet.js to the root directory causes the same issue - the file then tries to load other runtime files from the wrong location.
Note: All workarounds are lost every time abp bundle is executed.
Version
10.0.1
User Interface
Blazor
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
ABP Framework Version: 10.0.1
.NET Version: 10.0
Project Type: Blazor WebAssembly (Standalone) - NOT the Blazor Web App introduced in .NET 8
Operating System: Windows 11
Previous Working Version: ABP 9.3.3
Project History: This is a long-running project that has been upgraded through ABP versions starting from ABP 6. It uses the original Blazor WebAssembly (Standalone) project structure, not the newer Blazor Web App (Server + Client) structure introduced in .NET 8.