runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Blazor WASM (8.0 RC2) does not work on iOS 15.8

Open Andrzej-W opened this issue 3 years ago • 21 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

Blazor WASM application created from VS template (Blazor Web App, interactivity WebAssembly, per page) does not work on iOS 15.7 and 15.8 (tested on iPhone 6s). When I try to display "Counter" page I immediately see yellow message at the bottom of the page: Unhandled exception. Here is the screenshot from dev tools (iPhone connected to MacBook). Screenshot was made a few weeks ago, but I see exactly the same problem in .NET 8.0 RC2: obraz Exactly the same app works correctly on iOS 16.7.2 (iPhone 12 Pro Max) and Windows 11 (Firefox, Chrome, Edge) .NET 7 WASM application works on iOS 15.8.

iOS 15.8 (released a few days ago) is available for: iPhone 6s (all models), iPhone 7 (all models), iPhone SE (1st generation), iPad Air 2, iPad mini (4th generation), and iPod touch (7th generation) (source: https://support.apple.com/en-us/HT213990). According to this page https://developer.apple.com/support/app-store/ iOS 15.x is still popular.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Andrzej-W avatar Oct 29 '23 19:10 Andrzej-W

Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.

Issue Details

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

Blazor WASM application created from VS template (Blazor Web App, interactivity WebAssembly, per page) does not work on iOS 15.7 and 15.8 (tested on iPhone 6s). When I try to display "Counter" page I immediately see yellow message at the bottom of the page: Unhandled exception. Here is the screenshot from dev tools (iPhone connected to MacBook). Screenshot was made a few weeks ago, but I see exactly the same problem in .NET 8.0 RC2: obraz Exactly the same app works correctly on iOS 16.7.2 (iPhone 12 Pro Max) and Windows 11 (Firefox, Chrome, Edge) .NET 7 WASM application works on iOS 15.8.

iOS 15.8 (released a few days ago) is available for: iPhone 6s (all models), iPhone 7 (all models), iPhone SE (1st generation), iPad Air 2, iPad mini (4th generation), and iPod touch (7th generation) (source: https://support.apple.com/en-us/HT213990). According to this page https://developer.apple.com/support/app-store/ iOS 15.x is still popular.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

Author: Andrzej-W
Assignees: -
Labels:

arch-wasm, untriaged, area-VM-meta-mono

Milestone: -

ghost avatar Nov 01 '23 21:11 ghost

I guess SIMD, but the UX is not great

pavelsavara avatar Nov 02 '23 09:11 pavelsavara

@Andrzej-W Can you please share what version of Safari do you have on iOS 15.7 and 15.8?

maraf avatar Nov 02 '23 09:11 maraf

@maraf I'm not an iOS expert, but I think Safari on this system is an integral part of the operating system. According to this page https://developer.apple.com/documentation/safari-release-notes/safari-15_6-release-notes the newest Safari 15.x version is 15.6. iOS 15.7 and 15.8 was released to fix some security bugs only. My iPhone 6s has only official system updates and I believe I have Safari 15.6.

Support for WASM SIMD instructions was added in Safari 16.4 (https://developer.apple.com/documentation/safari-release-notes/safari-16_4-release-notes#WebAssembly).

Unfortunately I cannot disable SIMD in Blazor https://learn.microsoft.com/en-us/aspnet/core/blazor/tooling?view=aspnetcore-8.0&pivots=windows#single-instruction-multiple-data-simd to retest the application.

Andrzej-W avatar Nov 02 '23 23:11 Andrzej-W

Thanks for details.

You can disable SIMD (in Blazor) using <WasmEnableSIMD>false</WasmEnableSIMD> (>= .NET 8 RC2). The GH issue is open only for adding a CI test that disabling SIMD remains working. We will update the docs.

We are going to investigate why it shows manifests this way on iOS instead of the nicer error message we added and that works on older Chrome/FF

maraf avatar Nov 03 '23 09:11 maraf

Thank you @maraf for the tip. I can confirm that after adding <WasmEnableSIMD>false</WasmEnableSIMD> Blazor WASM works on my old iPhone 6s.

Is it technically possible to check for WASM SIMD availability at runtime? It would be nice to have it enabled but fallback to standard instructions in older browsers.

I think runtime checking would be also useful to check if the WASM implementation has no bugs. Look here, please: https://developer.apple.com/documentation/safari-release-notes/safari-17_2-release-notes#WebAssembly iOS 17 is not available for iPhone 8 and iPhone X. Do people still use these iPhone models? The answer is probably yes.

Andrzej-W avatar Nov 03 '23 15:11 Andrzej-W

We have such feature on our radar. It's slightly complicated because we have to build the app twice (and then select the correct version on runtime).

EDIT: https://github.com/dotnet/runtime/issues/78872

maraf avatar Nov 03 '23 16:11 maraf

I tried to run iOS 15.5 in emulator and when the WASM app was compiled with SIMD enabled, I got a nice message "This browser/engine doesn't support WASM SIMD. Please use a modern version. See also https://aka.ms/dotnet-wasm-features".

@Andrzej-W Can you please validate with RC2 that the message you are getting is as bad as the one on the screenshot from RC1? Please make sure that because of stale cache or something you are not looking at a stale version of the app.

maraf avatar Nov 03 '23 18:11 maraf

This issue has been marked needs-author-action and may be missing some important information.

ghost avatar Nov 03 '23 18:11 ghost

Thank you @maraf for explanation. It looks #78872 has .NET 9 milestone assigned - I have to wait :(

I have disabled SIMD and now my problem is solved, but I don't close this issue because you have written:

We are going to investigate why it shows manifests this way on iOS instead of the nicer error message we added and that works on older Chrome/FF

Let's assume this nice error message will somehow appear on the screen. Will it be possible to localize it to other languages?

I have just noticed your last message - I will repeat my tests. Do you test locally on your Mac? I'm working on Windows 11 computer and my application was published to external server - it is release build.

Andrzej-W avatar Nov 03 '23 18:11 Andrzej-W

Let's assume this nice error message will somehow appear on the screen. Will it be possible to localize it to other languages?

Are you asking from the developer point of view? In that case we open an issue to make them localized, but since you're the first one asking it's probably a very low priority.

If you want to show a message to the user, I would encourage you to do the SIMD check in your codebase and provide a message meaningful for the end user, because the messages we provide are developer oriented.

I have just noticed your last message - I will repeat my tests.

Appreciated!

Do you test locally on your Mac? I'm working on Windows 11 computer and my application was published to external server - it is release build.

Yes, locally. I wouldn't expect it to have any impact.

maraf avatar Nov 03 '23 18:11 maraf

This issue has been marked needs-author-action and may be missing some important information.

ghost avatar Nov 03 '23 18:11 ghost

I just created a new Blazor application and published it here: https://blazor.aspnet.pl/ Could you open it and select Counter from menu. On my iPhone 6s with iOS 15.8 I see "standard" Blazor error on yellow background "An unhandled error has occurred"

I have VS 2022 17.8.0 Preview 6.0. .NET SDK is 8.0.100-rc.2.23502.2

Andrzej-W avatar Nov 03 '23 19:11 Andrzej-W

It looks that published application doesn't display nice error message on real device and on simulator. Here is the screenshot from iOS 15.5 simulator: obraz

Andrzej-W avatar Nov 03 '23 21:11 Andrzej-W

As I mentioned earlier, the "nice" message is meant for developer only. I'm interested if you see it in the devtools.

maraf avatar Nov 03 '23 22:11 maraf

OK, now I understand what you mean. I can connect my iPhone to MacBook and then in Safari dev tools in console tab I see "nice" message about WASM SIMD. It looks that I can close this issue.

In the meantime I was thinking what to do with this "feature". Probably I will disable SIMD in my application because even the most beautiful message is useless for iPhone users. They cannot update Safari nor they can use any other modern browser. Should I display: Dear user, please buy a new iPhone, your old one is junk. This is probably an unacceptable user experience.

Andrzej-W avatar Nov 03 '23 23:11 Andrzej-W

OK, now I understand what you mean. I can connect my iPhone to MacBook and then in Safari dev tools in console tab I see "nice" message about WASM SIMD. It looks that I can close this issue.

Exactly. It should only hint developers why it doesn't work. It has no value for end users.

In the meantime I was thinking what to do with this "feature". Probably I will disable SIMD in my application because even the most beautiful message is useless for iPhone users. They cannot update Safari nor they can use any other modern browser. Should I display: Dear user, please buy a new iPhone, your old one is junk. This is probably an unacceptable user experience.

Disabling SIMD makes sense if you need support customers with older hardware. An alternative is to implement the side-by-side SIMD and non-SIMD app versions yourself and which between them before the Blazor app starts until we provide it in the box.

maraf avatar Nov 06 '23 08:11 maraf

Hmm, not sure if I should open a new issue. I got this issue on Safari (16.3) for macOS after upgrading to .NET 8. But setting WasmEnableSIMD to false just gives me another error:

Skjermbilde 2023-11-24 kl  13 14 21

I also tried setting WasmBuildNative to true without any luck. This is a bit critical, do I have to downgrade again?

mwarvik avatar Nov 24 '23 12:11 mwarvik

@mwarvik Second problematic feature with Safari is typically Wasm Exception Handling, can you please try setting <WasmEnableExceptionHandling>false</WasmEnableExceptionHandling>? Also, isn't any cache involved?

maraf avatar Nov 24 '23 14:11 maraf

@maraf Thanks for the answer. If I set <WasmEnableExceptionHandling>false</WasmEnableExceptionHandling>, the blazor-error-ui is not displayed, but the same error is still displayed in the console (and there are various issues with running the app).

I have tried clearing the cache, with no change in behavior.

mwarvik avatar Nov 26 '23 17:11 mwarvik