runtime: Blazor WASM applications on net8.0 freeze on startup on iOS 18 RC (22A3354) when built with AOT

Description

The Blazor WASM example project, when built against net8.0 with RunAOTCompilation, freezes on startup on iOS 18 Beta 2/3/4 (22A5297f/22A5307f/22A5316j). The same issue does not occur when building against net9.0 (-preview6), or when using iOS 18.0 beta 1 (22A5282m), iOS 17.5 or 16.4. It also doesn’t affect Safari Technology Preview for macOS. I’ve not been able to test it on macOS Beta, as I don’t have access to a Mac running the beta.

Reproduction Steps

  1. dotnet new blazorwasm
  2. Run dotnet publish -p:RunAOTCompilation=true
  3. Run python3 -m http.server 9000 -b 0.0.0.0 -d bin/Release/net8.0/publish/wwwroot
  4. Open <ip>:9000 on an iOS 18 Beta 4 device (real hardware or xCode Simulator)

Expected behavior

The application starts normally

Actual behavior

The application freezes on startup, with the loading indicator stuck at 100%.

The following logs are printed to console:

[Warning] MONO_WASM: Exception marshalling result of JS promise to CS:  (dotnet.runtime.8.0.7.e9r13h23hd.js, line 3)
RuntimeError: Out of bounds memory access (evaluating 'St.mono_wasm_write_managed_pointer_unsafe(t,e)')
<?>.wasm-function[35357]
set — dotnet.runtime.8.0.7.e9r13h23hd.js:3:7696
release — dotnet.runtime.8.0.7.e9r13h23hd.js:3:8465
kr — dotnet.runtime.8.0.7.e9r13h23hd.js:3:35559
(anonymous function) — dotnet.runtime.8.0.7.e9r13h23hd.js:3:209727
(anonymous function) — dotnet.runtime.8.0.7.e9r13h23hd.js:3:42386

[Error] [object WebAssembly.Exception]
	<?>.wasm-function[35231]
	<?>.wasm-function[28152]
	<?>.wasm-function[27916]
	<?>.wasm-function[30579]
	<?>.wasm-function[29954]
	<?>.wasm-function[29960]
	<?>.wasm-function[29984]
	<?>.wasm-function[35328]
	kr (dotnet.runtime.8.0.7.e9r13h23hd.js:3:35395)
	(anonymous function) (dotnet.runtime.8.0.7.e9r13h23hd.js:3:209274)
	Mr (dotnet.runtime.8.0.7.e9r13h23hd.js:3:37421)
	Pr (dotnet.runtime.8.0.7.e9r13h23hd.js:3:37561)

Regression?

No response

Known Workarounds

No response

Configuration

Tested on the following configuration (net8.0), but the issue also occurs when building on Arch Linux, using SDK 8.0.107 with runtime 8.0.7. Appears to work fine when built against net9.0 using the same configuration.

.NET SDK:
 Version:           9.0.100-preview.6.24328.19
 Commit:            ef4c241666
 Workload version:  9.0.100-manifests.21d7f649
 MSBuild version:   17.11.0-preview-24318-05+4a45d5633

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.5
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/9.0.100-preview.6.24328.19/

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
 [wasm-tools]
   Installation Source: SDK 9.0.100-preview.6
   Manifest Version:    9.0.0-preview.6.24327.7/9.0.100-preview.6
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/9.0.100-preview.6/microsoft.net.workload.mono.toolchain.current/9.0.0-preview.6.24327.7/WorkloadManifest.json
   Install Type:        FileBased

 [wasm-tools-net8]
   Installation Source: SDK 9.0.100-preview.6
   Manifest Version:    9.0.0-preview.6.24327.7/9.0.100-preview.6
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/9.0.100-preview.6/microsoft.net.workload.mono.toolchain.net8/9.0.0-preview.6.24327.7/WorkloadManifest.json
   Install Type:        FileBased


Host:
  Version:      9.0.0-preview.6.24327.7
  Architecture: arm64
  Commit:       static

.NET SDKs installed:
  8.0.303 [/usr/local/share/dotnet/sdk]
  9.0.100-preview.6.24328.19 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0-preview.6.24328.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0-preview.6.24327.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

Other information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 29

Most upvoted comments

@radekdoulik Is there any potential work arounds for this? I’m a bit concerned by the .NET 10 milestone for something quite so production critical.

Since this may be an iOS bug, I filed a radar with Apple (FB14644808) containing a link to this issue.

That makes sense, all browsers on iOS use the same WebKit engine internally.

We have been seeing same thing with our application and only affects iOS18>, but it breaks in all browser types and not only Safari. It also breaks on latest MacOS in safari, but works in other browsers.

I’m getting the same on our Blazor web app, .NET 8.0.10 SDK and nuget packages, phone on IOS 18.0.1

We have the same problem. iOS 18 crashes with MONO_WASM: Exception marshalling result of JS promise to CS: (dotnet.runtime.8.0.7.e9r13h23hd.js, line 3) RuntimeError: Out of bounds memory access (evaluating ‘St.mono_wasm_write_managed_pointer_unsafe(t,e)’)

The https://github.com/dotnet/maui/issues/23390#issuecomment-2286943437 fix does not work with our Blazor WASM application.

Many of our iOs users are reporting the problem to us. Would be nice if this problem could be fixed asap.

Interestingly, I can reproduce that crash on Safari TP Release 203 (Safari 18.0, WebKit 19620.1.6)

[Error] MONO_WASM: Out of bounds memory access (evaluating 'o.mono_background_exec()')
<?>.wasm-function[92505]@[wasm code]
<?>.wasm-function[87542]@[wasm code]
<?>.wasm-function[87592]@[wasm code]
<?>.wasm-function[84592]@[wasm code]
<?>.wasm-function[84587]@[wasm code]
<?>.wasm-function[84659]@[wasm code]
<?>.wasm-function[84689]@[wasm code]
<?>.wasm-function[61623]@[wasm code]
<?>.wasm-function[53752]@[wasm code]
<?>.wasm-function[53740]@[wasm code]
<?>.wasm-function[53736]@[wasm code]
<?>.wasm-function[53781]@[wasm code]
<?>.wasm-function[53785]@[wasm code]
<?>.wasm-function[26695]@[wasm code]
<?>.wasm-function[26694]@[wasm code]
<?>.wasm-function[26751]@[wasm code]
<?>.wasm-function[28605]@[wasm code]
<?>.wasm-function[22347]@[wasm code]
<?>.wasm-function[21371]@[wasm code]
<?>.wasm-function[22928]@[wasm code]
<?>.wasm-function[21412]@[wasm code]
<?>.wasm-function[22347]@[wasm code]
<?>.wasm-function[21975]@[wasm code]
<?>.wasm-function[21973]@[wasm code]
<?>.wasm-function[30019]@[wasm code]
<?>.wasm-function[84665]@[wasm code]
<?>.wasm-function[87542]@[wasm code]
<?>.wasm-function[87592]@[wasm code]
<?>.wasm-function[84592]@[wasm code]
<?>.wasm-function[84587]@[wasm code]
<?>.wasm-function[84659]@[wasm code]
<?>.wasm-function[84677]@[wasm code]
<?>.wasm-function[61627]@[wasm code]
<?>.wasm-function[21948]@[wasm code]
<?>.wasm-function[21968]@[wasm code]
<?>.wasm-function[23651]@[wasm code]
<?>.wasm-function[21653]@[wasm code]
<?>.wasm-function[21363]@[wasm code]
<?>.wasm-function[21395]@[wasm code]
<?>.wasm-function[21406]@[wasm code]
<?>.wasm-function[21417]@[wasm code]
<?>.wasm-function[59982]@[wasm code]
<?>.wasm-function[21407]@[wasm code]
<?>.wasm-function[21404]@[wasm code]
<?>.wasm-function[22157]@[wasm code]
<?>.wasm-function[22049]@[wasm code]
<?>.wasm-function[22048]@[wasm code]
<?>.wasm-function[59982]@[wasm code]
<?>.wasm-function[21945]@[wasm code]
<?>.wasm-function[23648]@[wasm code]
<?>.wasm-function[23836]@[wasm code]
<?>.wasm-function[59982]@[wasm code]
<?>.wasm-function[23835]@[wasm code]
<?>.wasm-function[70547]@[wasm code]
<?>.wasm-function[70492]@[wasm code]
<?>.wasm-function[23844]@[wasm code]
<?>.wasm-function[60002]@[wasm code]
<?>.wasm-function[60901]@[wasm code]
<?>.wasm-function[55238]@[wasm code]
<?>.wasm-function[60008]@[wasm code]
<?>.wasm-function[60007]@[wasm code]
<?>.wasm-function[61627]@[wasm code]
<?>.wasm-function[84665]@[wasm code]
<?>.wasm-function[87542]@[wasm code]
<?>.wasm-function[87592]@[wasm code]
<?>.wasm-function[84592]@[wasm code]
<?>.wasm-function[84587]@[wasm code]
<?>.wasm-function[84659]@[wasm code]
<?>.wasm-function[84697]@[wasm code]
<?>.wasm-function[62689]@[wasm code]
<?>.wasm-function[56085]@[wasm code]
<?>.wasm-function[56083]@[wasm code]
<?>.wasm-function[55952]@[wasm code]
<?>.wasm-function[60591]@[wasm code]
<?>.wasm-function[56771]@[wasm code]
<?>.wasm-function[53513]@[wasm code]
<?>.wasm-function[23823]@[wasm code]
<?>.wasm-function[60002]@[wasm code]
<?>.wasm-function[60901]@[wasm code]
<?>.wasm-function[55482]@[wasm code]
<?>.wasm-function[60008]@[wasm code]
<?>.wasm-function[60006]@[wasm code]
<?>.wasm-function[55284]@[wasm code]
<?>.wasm-function[55283]@[wasm code]
<?>.wasm-function[60984]@[wasm code]
<?>.wasm-function[85415]@[wasm code]
85415@[native code]
Yo@http://localhost:3000/_framework/dotnet.runtime.26xtx0erx2.js:3:55998
callUserCallback@http://localhost:3000/_framework/dotnet.native.ck80easzdg.js:8:86558
@http://localhost:3000/_framework/dotnet.native.ck80easzdg.js:8:86838
	y (dotnet.js:3:1180)
	(anonymous function) (dotnet.js:3:27621)
	at (dotnet.js:3:27905)
	Yo (dotnet.runtime.26xtx0erx2.js:3:56024)
	callUserCallback (dotnet.native.ck80easzdg.js:8:86559)
	(anonymous function) (dotnet.native.ck80easzdg.js:8:86839)
[Error] RuntimeError: Out of bounds memory access (evaluating 'o.mono_background_exec()')
	quit_ (dotnet.native.ck80easzdg.js:8:448)
	handleException (dotnet.native.ck80easzdg.js:8:86363)
	callUserCallback (dotnet.native.ck80easzdg.js:8:86598)
	(anonymous function) (dotnet.native.ck80easzdg.js:8:86839)