dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.41k stars 4.76k forks source link

Stock Blazor standalone app with AOT compilation enabled fails to load in up-to-date Chrome when the host OS is Linux #110056

Open kmk-irc opened 14 hours ago

kmk-irc commented 14 hours ago

Is there an existing issue for this?

Describe the bug

It was recently discovered that our existing standalone Blazor app, with AOT compilation enabled, was failing to load on Chromebooks, which my employer uses exclusively to run this particular app in its healthcare clinics. After much trial and error, the only resolution we were able to find was to disable AOT compilation.

When AOT is enabled, the only error that appears in the Chrome Developer Tools Console is the following:

Error: AggregateException_ctor_DefaultMessage (InvalidCharacterWithinString, 0x0D LineNumber: 1 | BytePositionInLine: 19.) at Jn (dotnet.runtime.js:3:31615) at Ll (dotnet.runtime.js:3:182497) at dotnet.native.wasm:0x19f867 at dotnet.native.wasm:0x1a11e4 at dotnet.native.wasm:0x1a684b at dotnet.native.wasm:0x5279d2 at dotnet.native.wasm:0x6872f2 at dotnet.native.wasm:0x6a43f6 at dotnet.native.wasm:0x683c64 at dotnet.native.wasm:0x677047

I was able to determine that the file the runtime is trying and failing to read is the app's appsettings.json file.

As a further test, I attempted to access the app with the latest version of Chrome (at the time of this writing) but from within an Ubuntu VM. The same error occurs there as well.

Furthermore, to ensure this wasn't just an issue with our app, I created a new app from the stock Blazor Standalone template in Visual Studio (17.12.0) and enabled AOT compilation. The only thing I added to this project is an appsettings.json file. I attempted to access this app from an up to date Chromebook and the Ubuntu VM. Both result in the same error. Curiously, the error does not occur in Chrome running on Android.

The stock Blazor application I tested with can be found here:

https://ibsvc2.droidspot.com/

Expected Behavior

Chrome running on a Linux host OS should be able to load a Blazor standalone app when AOT compilation is enabled.

Steps To Reproduce

  1. Create a new app from the stock Blazor Standalone template in Visual Studio.
  2. Enable AOT compilation.
  3. Add an appsettings.json file.
  4. Publish and deploy the app to a web host.
  5. Access the app from Chrome running on a Linux host OS (ChromeOS, Ubuntu, Mint, ect), but not Android, which doesn't appear to have this issue.

    Exceptions (if any)

No response

.NET Version

8.0.11 & 9.0.100

Anything else?

This issue appears in both the latest versions of .NET 8 and .NET 9 (8.0.11 & 9.0.100)