dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

MAUI Blazor in .NET 9 does not run on Android API level 31 and below #25862

Open thomasbach-dk opened 3 days ago

thomasbach-dk commented 3 days ago

Description

I am currently playing with an upgrade from .NET 8 to .NET 9. We have a .NET MAUI Blazor (Hybrid) app, and when we run the app on Android (emulator) API level 31 we get the following console error:

11-14 13:12:32.688 I/chromium(12480): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token '{'", source: https://0.0.0.0/_framework/blazor.webview.js (1)
[INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token '{'", source: https://0.0.0.0/_framework/blazor.webview.js (1)

This error prevents the app from loading.

Running the app on Android API level 32 and above the issue does not occur.

In terms of the documentation of .NET 9 Android API level 24 should be supported.

UPDATE: I figured out that updating the Android System WebView in the emulator fixed this issue.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

9.0.0 GA

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.402

Affected platforms

Android

Affected platform versions

Android API level 31 and below (Android 12 and below)

Did you find any workaround?

No

Relevant log output

11-14 13:12:32.688 I/chromium(12480): [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token '{'", source: https://0.0.0.0/_framework/blazor.webview.js (1)
[INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected token '{'", source: https://0.0.0.0/_framework/blazor.webview.js (1)
caoyiliang commented 2 days ago

Image 我也发生了,我是Android10,使用新建的项目出现了同样的错误,设备链接:https://www.zebra.cn/cn/zh/support-downloads/mobile-computers/handheld/tc21.html

Ying-6 commented 2 days ago

This issue has been verified using Visual Studio 17.13.0 Preview 1.0 (9.0.10 & 9.0.0). Can repro this issue. Works fine on 8.0.40 & 8.0.100.

Eilon commented 2 days ago

Possible dupe: https://github.com/dotnet/aspnetcore/issues/53699 (the error in the other issue is slightly different, but possibly same root cause)