dotnet / runtime

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

Blazor WASM applications crash on startup on iOS 16.4-16.6 when built with AOT & referencing certain dependencies #105912

Open zotanmew opened 1 month ago

zotanmew commented 1 month ago

Description

The Blazor WASM example project, after adding specific packages (see below), when built against net8.0 or net9.0 with RunAOTCompilation, crashes on startup on Safari iOS 16.4-16.6. The same issue does not occur when using Safari on iOS 17.5.

Affected packages:

Reproduction Steps

dotnet new blazorwasm -f net8.0
dotnet add package Microsoft.AspNetCore.SignalR.Protocols.MessagePack
dotnet publish -p:RunAOTCompilation=true
python3 -m http.server 9000 -b 0.0.0.0 -d bin/Release/net8.0/publish/wwwroot

Expected behavior

App displays hello world

Actual behavior

App crashes with: [Error] Error: AggregateException_ctor_DefaultMessage (Arg_IndexOutOfRangeException)

Full stacktrace:

[Error] Error: AggregateException_ctor_DefaultMessage (Arg_IndexOutOfRangeException) — dotnet.runtime.8.0.7.e9r13h23hd.js:1115
    (anonymous function) (blazor.webassembly.js:1:45557)

Regression?

No response

Known Workarounds

Building -p:WasmEnableSIMD=false bypasses the issue. This is strange, since Safari for iOS supports SIMD from iOS 16.4 onwards.

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. Also happens 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

zotanmew commented 1 month ago

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