unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.51k stars 690 forks source link

Mac Catalyst (arm64): WebView is blocking keyboard input #9877

Open edoust opened 1 year ago

edoust commented 1 year ago

Current behavior

Add a UnoWKWebView, WebView or WKWebView to the UI (code-behind or in XAML does not matter)

The browser control accepts mouse inputs. The browser control does not accept keyboard inputs.

Also, global shortcuts like CMD-Q (quit app) do not work anymore, they seem to be blocked

I know that this worked in earlier v4.x versions of Uno

This happens for both maccatalyst-arm64 as well as maccatalyst-x64

Expected behavior

WebView should accept keyboard input, and not block global shortcuts

How to reproduce it (as minimally and precisely as possible)

See the attached repro, it is just an empty project with a mainpage, in whose constructor I placed this code:

var webView = new UnoWKWebView();
webView.LoadRequest(new Foundation.NSUrlRequest(new Foundation.NSUrl("https://github.com")));
Content = webView;

repro.zip

Workaround

I don't know of any workarounds, any workaround (if possible) would be appreciated

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

Uno.WinUI, v4.5.9 Uno.WinUI, v4.6.0-dev.253

Affected platforms

macOS

IDE

Visual Studio for Mac

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

dr1rrb commented 1 year ago

Hey @edoust, I'm unable to repro on my side:

https://user-images.githubusercontent.com/8635919/214668724-39f725bd-a893-463a-a8bb-3c5875388fb3.mp4

Could give me more info on your setup ?

On my side I'm running macOS 13.1 and the only thing I changed on your repro is that I used .net 7 instead of .net 6. (So this is with Uno 4.5.9)

CC @veler @jeromelaban

edoust commented 1 year ago

Hey @dr1rrb I changed the project settings, with these settings I get the error again:

<TargetFrameworks>net7.0-maccatalyst15.4</TargetFrameworks>
<RuntimeIdentifier>maccatalyst-arm64</RuntimeIdentifier>

On x64 it doesn't seem to happen anymore... I am also on macOS 13.1

dr1rrb commented 1 year ago

I don't have any mac ARM device, @jeromelaban will try to have a look then.

jeromelaban commented 1 year ago

This is a curious issue, and if it happens on a specific architecture, it may be a Catalyst platform issue. @veler are you also on an M1 ?

veler commented 1 year ago

@jeromelaban sorry for the late reply. Yes, I'm on an M1.

spouliot commented 1 year ago

This works fine on an Apple silicon (M2) Mac when Rosetta is used. IOW it's related to the binary architecture (x64 works, arm64 does not), not the Uno code itself.

This is likely an Apple bug (looking thru them) and I'll see if I can find a workaround.

spouliot commented 1 year ago

As expected using a WKWebView, instead of the UnoWKWebView, has the same behaviour.

OTOH this seems to work fine when using directly the Microsoft SDK (net7.0-maccatalyst).

spouliot commented 1 year ago

How Microsoft deals with Mac Catalyst is a bit weird. It's a JITed application for x64 that requires the interpreter (or it crash) or an AOTed application for arm64 (or Apple rejects the app) without the interpreter (or it crash).

That means there's a lot of differences between the binaries for both architectures. Starting with their sizes... 4.4 vs 207 MB for debug builds.

❯ l bin/Debug/net6.0-maccatalyst/maccatalyst-x64/sdk.app/Contents/MacOS/sdk
-rwxr-xr-x@ 1 poupou  staff   4.4M 30 Jan 13:08 bin/Debug/net6.0-maccatalyst/maccatalyst-x64/sdk.app/Contents/MacOS/sdk

❯ l bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MacOS/sdk
-rwxr-xr-x@ 1 poupou  staff   207M 30 Jan 13:20 bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MacOS/sdk

Something happens on arm64 that affects/breaks the keyboard input. It might be something inside Uno (since a simple test app with the MS SDK works) or something else that gets included (the linked output won't be identical and, next step, needs to be analyzed).

The easy workaround (at least for now) would be to build/ship only the x64 version of the application and let Rosetta do it's magic for arm64-based Macs.

veler commented 1 year ago

Interesting insight @spouliot , thank you!

The easy workaround (at least for now) would be to build/ship only the x64 version of the application and let Rosetta do it's magic for arm64-based Macs.

Easy indeed. At the same time it has a pretty big impact on the app startup time in my experience. Starting a x64 app on Apple M1 is super slow. About 5 sec bouncing in the Dock before the UI appear, while it's pretty much instant for arm64. Easy workaround but costly performance impact unfortunately.

Do you folks have a good contact for asking why there's such a big .app size difference between x64 and arm64? 4.4 sound super small. Are you sure the app was self-contained?

spouliot commented 1 year ago

Do you folks have a good contact for asking why there's such a big .app size difference between x64 and arm64?

You can ask the MS folks (either the iOS/Mac or Mono teams) on Discord (DotNetEvolution) but I can answer that too :-)

4.4 sound super small. Are you sure the app was self-contained?

This was the size of the executable binaries, not the full application bundles.

4.4 MB (for x64) is very small since it's JITed (and interpreted). So the executable size is mostly the Mono runtime and a few bits of native code. This means the .dll contains both the IL and the metadata.

207 MB (for arm64) is huge but everything it fully AOTed (there won't be any JITing or interpreting at runtime). The executable size contains all the code, there's no IL (at least for release builds) inside the .dll, only the metadata.

As Ahead of Time (AOT) means compiling every at build time you end up with a much larger executable (even if the linker helps a lot) and much longer build times. However you (generally) have much better performance at runtime, in particular application startup times are much better.

spouliot commented 1 year ago

For reference, this is the closest reported issue I found https://developer.apple.com/forums/thread/721141 but the answer I got (from the OP) is diverging from this case (issues with x64, nor arm64).

Mac Catalyst WKWebView keyDown nev… | Apple Developer Forums
spouliot commented 1 year ago
❯ ls -l ./sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
-rwxr--r--@ 1 poupou  staff  24368528 29 Nov 11:40 ./sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
❯ ls -l ./sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
-rwxr--r--@ 1 poupou  staff  24368528 29 Nov 11:41 ./sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
❯ shasum ./sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
1b785f431c7d876cbc586d3109299ef880d8bea1  ./sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
❯ shasum ./sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
de7ea06ca56456804761688ccbd5b54835be3eef  ./sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll

❯ ls -l sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
-rwxr--r--@ 1 poupou  staff  24368528 29 Nov 11:40 sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
❯ shasum sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll
de7ea06ca56456804761688ccbd5b54835be3eef  sdk/bin/Debug/net6.0-maccatalyst/maccatalyst-arm64/sdk.app/Contents/MonoBundle/Microsoft.MacCatalyst.dll

So it's not related to the linker, at least the trimming parts, as it is not modifying the platform assembly.

spouliot commented 1 year ago

and, as expected, both custom-linker-options.txt files are identical - except for the paths...

I'm diffing the bin logs... which gives a quite large output, stay tuned.

spouliot commented 1 year ago

Nothing stands out in the binlog diffs :(

I suspected something could be different for the generated registrar code but no luck again

--- ./sdk/obj/Debug/net7.0-maccatalyst/maccatalyst-x64/linker-cache/registrar.mm    2023-02-27 14:53:18
+++ ./sdk/obj/Debug/net7.0-maccatalyst/maccatalyst-arm64/linker-cache/registrar.mm  2023-02-27 14:44:51
@@ -55233,7 +55233,7 @@
    };

    static const MTAssembly __xamarin_registration_assemblies [] = {
-       { "sdk", "29aad62e-28d7-43a9-b703-a6ae0cf5d1dc" }, 
+       { "sdk", "0b84fed0-0831-414f-aaa2-c9eecd45c0dc" }, 
        { "Microsoft.CSharp", "bcfcdf3f-7306-46b3-af4e-bb5c7e341332" }, 
        { "Microsoft.VisualBasic.Core", "b9866746-1b71-4ecb-bacc-2b019cde08f3" }, 
        { "Microsoft.VisualBasic", "2f9b5f73-20b4-4e96-8baa-07d340f57bfa" }, 
@@ -55257,7 +55257,7 @@
        { "System.Core", "92a82633-1515-41cd-8ca4-e048ae0a841e" }, 
        { "System.Data.Common", "304d42eb-c56a-4357-8aa9-232bcec6f9c6" }, 
        { "System.Data.DataSetExtensions", "d7ff2965-fe13-4eb5-9868-0600d6c921a8" }, 
-       { "System.Data", "60d7b6b1-4ab6-4435-bb1d-12e9539c93c2" }, 
+       { "System.Data", "1320906c-f5da-4569-bd32-fa429dabee78" }, 
        { "System.Diagnostics.Contracts", "00d633fd-2c22-47b2-9131-af95cb28a1b0" }, 
        { "System.Diagnostics.Debug", "0c671dbd-edec-42cd-8731-9f2f5545ddeb" }, 
        { "System.Diagnostics.DiagnosticSource", "694607f3-2f7c-492b-ab9d-df6b76f4781a" }, 
@@ -55396,12 +55396,12 @@
        { "System.Xml.XPath", "f8c286e8-5aa8-4ee3-90b7-245d96f459d2" }, 
        { "System.Xml.XmlDocument", "1f0caad8-10de-4429-a0aa-6cd18bdc6f66" }, 
        { "System.Xml.XmlSerializer", "7682c720-1563-4d0a-bcfd-ec8ee9552c73" }, 
-       { "System.Xml", "4aceead0-7c9c-44b3-a4a9-1bf5d4112834" }, 
-       { "System", "0fba0e53-a82d-4f19-9036-9ccc949d5068" }, 
+       { "System.Xml", "d2c0ddab-fd40-4e1c-85e3-37613ac60e2b" }, 
+       { "System", "56e8656e-0237-40fb-898f-5e9582920f16" }, 
        { "WindowsBase", "26f719fa-50b9-4b93-a4ac-7198099e23cb" }, 
-       { "mscorlib", "8cbb59e5-80fb-42b4-9855-240149ba0025" }, 
+       { "mscorlib", "b9d76ebf-3ad1-4f1c-8a39-4af1ac93f1b8" }, 
        { "netstandard", "d1fa4448-1029-4c37-9e51-b9b2cbbbdd29" }, 
-       { "System.Private.CoreLib", "668b8e0c-8407-43bb-a5a5-d8ece5a3ebcf" }, 
+       { "System.Private.CoreLib", "1efa9d65-c6eb-4ddc-aa1d-834b3d612cf0" }, 
        { "Microsoft.MacCatalyst", "2da0f2dd-7c6c-4c71-adca-16f54868181f" }
    };

Not all files are identical but that's expected.

Same for the generated initialization code, only difference is about the full AOT.

--- ./sdk/obj/Debug/net7.0-maccatalyst/maccatalyst-x64/linker-cache/main.x86_64.mm  2023-02-27 14:53:18
+++ ./sdk/obj/Debug/net7.0-maccatalyst/maccatalyst-arm64/linker-cache/main.arm64.mm 2023-02-27 14:44:51
@@ -18,15 +18,357 @@

 #include "xamarin/xamarin.h"

+extern void *mono_aot_module_sdk_info;
+extern void *mono_aot_module_Microsoft_CSharp_info;
+extern void *mono_aot_module_Microsoft_VisualBasic_Core_info;
+extern void *mono_aot_module_Microsoft_VisualBasic_info;
+extern void *mono_aot_module_Microsoft_Win32_Primitives_info;
+extern void *mono_aot_module_Microsoft_Win32_Registry_info;
+extern void *mono_aot_module_System_AppContext_info;
+extern void *mono_aot_module_System_Buffers_info;
+extern void *mono_aot_module_System_Collections_Concurrent_info;
+extern void *mono_aot_module_System_Collections_Immutable_info;
+extern void *mono_aot_module_System_Collections_NonGeneric_info;
+extern void *mono_aot_module_System_Collections_Specialized_info;
+extern void *mono_aot_module_System_Collections_info;
+extern void *mono_aot_module_System_ComponentModel_Annotations_info;
+extern void *mono_aot_module_System_ComponentModel_DataAnnotations_info;
+extern void *mono_aot_module_System_ComponentModel_EventBasedAsync_info;
+extern void *mono_aot_module_System_ComponentModel_Primitives_info;
+extern void *mono_aot_module_System_ComponentModel_TypeConverter_info;
+extern void *mono_aot_module_System_ComponentModel_info;
+extern void *mono_aot_module_System_Configuration_info;
+extern void *mono_aot_module_System_Console_info;
+extern void *mono_aot_module_System_Core_info;
+extern void *mono_aot_module_System_Data_Common_info;
+extern void *mono_aot_module_System_Data_DataSetExtensions_info;
+extern void *mono_aot_module_System_Data_info;
+extern void *mono_aot_module_System_Diagnostics_Contracts_info;
+extern void *mono_aot_module_System_Diagnostics_Debug_info;
+extern void *mono_aot_module_System_Diagnostics_DiagnosticSource_info;
+extern void *mono_aot_module_System_Diagnostics_FileVersionInfo_info;
+extern void *mono_aot_module_System_Diagnostics_Process_info;
+extern void *mono_aot_module_System_Diagnostics_StackTrace_info;
+extern void *mono_aot_module_System_Diagnostics_TextWriterTraceListener_info;
+extern void *mono_aot_module_System_Diagnostics_Tools_info;
+extern void *mono_aot_module_System_Diagnostics_TraceSource_info;
+extern void *mono_aot_module_System_Diagnostics_Tracing_info;
+extern void *mono_aot_module_System_Drawing_Primitives_info;
+extern void *mono_aot_module_System_Drawing_info;
+extern void *mono_aot_module_System_Dynamic_Runtime_info;
+extern void *mono_aot_module_System_Formats_Asn1_info;
+extern void *mono_aot_module_System_Formats_Tar_info;
+extern void *mono_aot_module_System_Globalization_Calendars_info;
+extern void *mono_aot_module_System_Globalization_Extensions_info;
+extern void *mono_aot_module_System_Globalization_info;
+extern void *mono_aot_module_System_IO_Compression_Brotli_info;
+extern void *mono_aot_module_System_IO_Compression_FileSystem_info;
+extern void *mono_aot_module_System_IO_Compression_ZipFile_info;
+extern void *mono_aot_module_System_IO_Compression_info;
+extern void *mono_aot_module_System_IO_FileSystem_AccessControl_info;
+extern void *mono_aot_module_System_IO_FileSystem_DriveInfo_info;
+extern void *mono_aot_module_System_IO_FileSystem_Primitives_info;
+extern void *mono_aot_module_System_IO_FileSystem_Watcher_info;
+extern void *mono_aot_module_System_IO_FileSystem_info;
+extern void *mono_aot_module_System_IO_IsolatedStorage_info;
+extern void *mono_aot_module_System_IO_MemoryMappedFiles_info;
+extern void *mono_aot_module_System_IO_Pipes_AccessControl_info;
+extern void *mono_aot_module_System_IO_Pipes_info;
+extern void *mono_aot_module_System_IO_UnmanagedMemoryStream_info;
+extern void *mono_aot_module_System_IO_info;
+extern void *mono_aot_module_System_Linq_Expressions_info;
+extern void *mono_aot_module_System_Linq_Parallel_info;
+extern void *mono_aot_module_System_Linq_Queryable_info;
+extern void *mono_aot_module_System_Linq_info;
+extern void *mono_aot_module_System_Memory_info;
+extern void *mono_aot_module_System_Net_Http_Json_info;
+extern void *mono_aot_module_System_Net_Http_info;
+extern void *mono_aot_module_System_Net_HttpListener_info;
+extern void *mono_aot_module_System_Net_Mail_info;
+extern void *mono_aot_module_System_Net_NameResolution_info;
+extern void *mono_aot_module_System_Net_NetworkInformation_info;
+extern void *mono_aot_module_System_Net_Ping_info;
+extern void *mono_aot_module_System_Net_Primitives_info;
+extern void *mono_aot_module_System_Net_Quic_info;
+extern void *mono_aot_module_System_Net_Requests_info;
+extern void *mono_aot_module_System_Net_Security_info;
+extern void *mono_aot_module_System_Net_ServicePoint_info;
+extern void *mono_aot_module_System_Net_Sockets_info;
+extern void *mono_aot_module_System_Net_WebClient_info;
+extern void *mono_aot_module_System_Net_WebHeaderCollection_info;
+extern void *mono_aot_module_System_Net_WebProxy_info;
+extern void *mono_aot_module_System_Net_WebSockets_Client_info;
+extern void *mono_aot_module_System_Net_WebSockets_info;
+extern void *mono_aot_module_System_Net_info;
+extern void *mono_aot_module_System_Numerics_Vectors_info;
+extern void *mono_aot_module_System_Numerics_info;
+extern void *mono_aot_module_System_ObjectModel_info;
+extern void *mono_aot_module_System_Private_DataContractSerialization_info;
+extern void *mono_aot_module_System_Private_Uri_info;
+extern void *mono_aot_module_System_Private_Xml_Linq_info;
+extern void *mono_aot_module_System_Private_Xml_info;
+extern void *mono_aot_module_System_Reflection_DispatchProxy_info;
+extern void *mono_aot_module_System_Reflection_Emit_ILGeneration_info;
+extern void *mono_aot_module_System_Reflection_Emit_Lightweight_info;
+extern void *mono_aot_module_System_Reflection_Emit_info;
+extern void *mono_aot_module_System_Reflection_Extensions_info;
+extern void *mono_aot_module_System_Reflection_Metadata_info;
+extern void *mono_aot_module_System_Reflection_Primitives_info;
+extern void *mono_aot_module_System_Reflection_TypeExtensions_info;
+extern void *mono_aot_module_System_Reflection_info;
+extern void *mono_aot_module_System_Resources_Reader_info;
+extern void *mono_aot_module_System_Resources_ResourceManager_info;
+extern void *mono_aot_module_System_Resources_Writer_info;
+extern void *mono_aot_module_System_Runtime_CompilerServices_Unsafe_info;
+extern void *mono_aot_module_System_Runtime_CompilerServices_VisualC_info;
+extern void *mono_aot_module_System_Runtime_Extensions_info;
+extern void *mono_aot_module_System_Runtime_Handles_info;
+extern void *mono_aot_module_System_Runtime_InteropServices_JavaScript_info;
+extern void *mono_aot_module_System_Runtime_InteropServices_RuntimeInformation_info;
+extern void *mono_aot_module_System_Runtime_InteropServices_info;
+extern void *mono_aot_module_System_Runtime_Intrinsics_info;
+extern void *mono_aot_module_System_Runtime_Loader_info;
+extern void *mono_aot_module_System_Runtime_Numerics_info;
+extern void *mono_aot_module_System_Runtime_Serialization_Formatters_info;
+extern void *mono_aot_module_System_Runtime_Serialization_Json_info;
+extern void *mono_aot_module_System_Runtime_Serialization_Primitives_info;
+extern void *mono_aot_module_System_Runtime_Serialization_Xml_info;
+extern void *mono_aot_module_System_Runtime_Serialization_info;
+extern void *mono_aot_module_System_Runtime_info;
+extern void *mono_aot_module_System_Security_AccessControl_info;
+extern void *mono_aot_module_System_Security_Claims_info;
+extern void *mono_aot_module_System_Security_Cryptography_Algorithms_info;
+extern void *mono_aot_module_System_Security_Cryptography_Cng_info;
+extern void *mono_aot_module_System_Security_Cryptography_Csp_info;
+extern void *mono_aot_module_System_Security_Cryptography_Encoding_info;
+extern void *mono_aot_module_System_Security_Cryptography_OpenSsl_info;
+extern void *mono_aot_module_System_Security_Cryptography_Primitives_info;
+extern void *mono_aot_module_System_Security_Cryptography_X509Certificates_info;
+extern void *mono_aot_module_System_Security_Cryptography_info;
+extern void *mono_aot_module_System_Security_Principal_Windows_info;
+extern void *mono_aot_module_System_Security_Principal_info;
+extern void *mono_aot_module_System_Security_SecureString_info;
+extern void *mono_aot_module_System_Security_info;
+extern void *mono_aot_module_System_ServiceModel_Web_info;
+extern void *mono_aot_module_System_ServiceProcess_info;
+extern void *mono_aot_module_System_Text_Encoding_CodePages_info;
+extern void *mono_aot_module_System_Text_Encoding_Extensions_info;
+extern void *mono_aot_module_System_Text_Encoding_info;
+extern void *mono_aot_module_System_Text_Encodings_Web_info;
+extern void *mono_aot_module_System_Text_Json_info;
+extern void *mono_aot_module_System_Text_RegularExpressions_info;
+extern void *mono_aot_module_System_Threading_Channels_info;
+extern void *mono_aot_module_System_Threading_Overlapped_info;
+extern void *mono_aot_module_System_Threading_Tasks_Dataflow_info;
+extern void *mono_aot_module_System_Threading_Tasks_Extensions_info;
+extern void *mono_aot_module_System_Threading_Tasks_Parallel_info;
+extern void *mono_aot_module_System_Threading_Tasks_info;
+extern void *mono_aot_module_System_Threading_Thread_info;
+extern void *mono_aot_module_System_Threading_ThreadPool_info;
+extern void *mono_aot_module_System_Threading_Timer_info;
+extern void *mono_aot_module_System_Threading_info;
+extern void *mono_aot_module_System_Transactions_Local_info;
+extern void *mono_aot_module_System_Transactions_info;
+extern void *mono_aot_module_System_ValueTuple_info;
+extern void *mono_aot_module_System_Web_HttpUtility_info;
+extern void *mono_aot_module_System_Web_info;
+extern void *mono_aot_module_System_Windows_info;
+extern void *mono_aot_module_System_Xml_Linq_info;
+extern void *mono_aot_module_System_Xml_ReaderWriter_info;
+extern void *mono_aot_module_System_Xml_Serialization_info;
+extern void *mono_aot_module_System_Xml_XDocument_info;
+extern void *mono_aot_module_System_Xml_XPath_XDocument_info;
+extern void *mono_aot_module_System_Xml_XPath_info;
+extern void *mono_aot_module_System_Xml_XmlDocument_info;
+extern void *mono_aot_module_System_Xml_XmlSerializer_info;
+extern void *mono_aot_module_System_Xml_info;
+extern void *mono_aot_module_System_info;
+extern void *mono_aot_module_WindowsBase_info;
+extern void *mono_aot_module_mscorlib_info;
+extern void *mono_aot_module_netstandard_info;
+extern void *mono_aot_module_System_Private_CoreLib_info;
+extern void *mono_aot_module_Microsoft_MacCatalyst_info;

 void xamarin_register_modules_impl ()
 {
+   mono_aot_register_module (mono_aot_module_sdk_info);
+   mono_aot_register_module (mono_aot_module_Microsoft_CSharp_info);
+   mono_aot_register_module (mono_aot_module_Microsoft_VisualBasic_Core_info);
+   mono_aot_register_module (mono_aot_module_Microsoft_VisualBasic_info);
+   mono_aot_register_module (mono_aot_module_Microsoft_Win32_Primitives_info);
+   mono_aot_register_module (mono_aot_module_Microsoft_Win32_Registry_info);
+   mono_aot_register_module (mono_aot_module_System_AppContext_info);
+   mono_aot_register_module (mono_aot_module_System_Buffers_info);
+   mono_aot_register_module (mono_aot_module_System_Collections_Concurrent_info);
+   mono_aot_register_module (mono_aot_module_System_Collections_Immutable_info);
+   mono_aot_register_module (mono_aot_module_System_Collections_NonGeneric_info);
+   mono_aot_register_module (mono_aot_module_System_Collections_Specialized_info);
+   mono_aot_register_module (mono_aot_module_System_Collections_info);
+   mono_aot_register_module (mono_aot_module_System_ComponentModel_Annotations_info);
+   mono_aot_register_module (mono_aot_module_System_ComponentModel_DataAnnotations_info);
+   mono_aot_register_module (mono_aot_module_System_ComponentModel_EventBasedAsync_info);
+   mono_aot_register_module (mono_aot_module_System_ComponentModel_Primitives_info);
+   mono_aot_register_module (mono_aot_module_System_ComponentModel_TypeConverter_info);
+   mono_aot_register_module (mono_aot_module_System_ComponentModel_info);
+   mono_aot_register_module (mono_aot_module_System_Configuration_info);
+   mono_aot_register_module (mono_aot_module_System_Console_info);
+   mono_aot_register_module (mono_aot_module_System_Core_info);
+   mono_aot_register_module (mono_aot_module_System_Data_Common_info);
+   mono_aot_register_module (mono_aot_module_System_Data_DataSetExtensions_info);
+   mono_aot_register_module (mono_aot_module_System_Data_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_Contracts_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_Debug_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_DiagnosticSource_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_FileVersionInfo_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_Process_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_StackTrace_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_TextWriterTraceListener_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_Tools_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_TraceSource_info);
+   mono_aot_register_module (mono_aot_module_System_Diagnostics_Tracing_info);
+   mono_aot_register_module (mono_aot_module_System_Drawing_Primitives_info);
+   mono_aot_register_module (mono_aot_module_System_Drawing_info);
+   mono_aot_register_module (mono_aot_module_System_Dynamic_Runtime_info);
+   mono_aot_register_module (mono_aot_module_System_Formats_Asn1_info);
+   mono_aot_register_module (mono_aot_module_System_Formats_Tar_info);
+   mono_aot_register_module (mono_aot_module_System_Globalization_Calendars_info);
+   mono_aot_register_module (mono_aot_module_System_Globalization_Extensions_info);
+   mono_aot_register_module (mono_aot_module_System_Globalization_info);
+   mono_aot_register_module (mono_aot_module_System_IO_Compression_Brotli_info);
+   mono_aot_register_module (mono_aot_module_System_IO_Compression_FileSystem_info);
+   mono_aot_register_module (mono_aot_module_System_IO_Compression_ZipFile_info);
+   mono_aot_register_module (mono_aot_module_System_IO_Compression_info);
+   mono_aot_register_module (mono_aot_module_System_IO_FileSystem_AccessControl_info);
+   mono_aot_register_module (mono_aot_module_System_IO_FileSystem_DriveInfo_info);
+   mono_aot_register_module (mono_aot_module_System_IO_FileSystem_Primitives_info);
+   mono_aot_register_module (mono_aot_module_System_IO_FileSystem_Watcher_info);
+   mono_aot_register_module (mono_aot_module_System_IO_FileSystem_info);
+   mono_aot_register_module (mono_aot_module_System_IO_IsolatedStorage_info);
+   mono_aot_register_module (mono_aot_module_System_IO_MemoryMappedFiles_info);
+   mono_aot_register_module (mono_aot_module_System_IO_Pipes_AccessControl_info);
+   mono_aot_register_module (mono_aot_module_System_IO_Pipes_info);
+   mono_aot_register_module (mono_aot_module_System_IO_UnmanagedMemoryStream_info);
+   mono_aot_register_module (mono_aot_module_System_IO_info);
+   mono_aot_register_module (mono_aot_module_System_Linq_Expressions_info);
+   mono_aot_register_module (mono_aot_module_System_Linq_Parallel_info);
+   mono_aot_register_module (mono_aot_module_System_Linq_Queryable_info);
+   mono_aot_register_module (mono_aot_module_System_Linq_info);
+   mono_aot_register_module (mono_aot_module_System_Memory_info);
+   mono_aot_register_module (mono_aot_module_System_Net_Http_Json_info);
+   mono_aot_register_module (mono_aot_module_System_Net_Http_info);
+   mono_aot_register_module (mono_aot_module_System_Net_HttpListener_info);
+   mono_aot_register_module (mono_aot_module_System_Net_Mail_info);
+   mono_aot_register_module (mono_aot_module_System_Net_NameResolution_info);
+   mono_aot_register_module (mono_aot_module_System_Net_NetworkInformation_info);
+   mono_aot_register_module (mono_aot_module_System_Net_Ping_info);
+   mono_aot_register_module (mono_aot_module_System_Net_Primitives_info);
+   mono_aot_register_module (mono_aot_module_System_Net_Quic_info);
+   mono_aot_register_module (mono_aot_module_System_Net_Requests_info);
+   mono_aot_register_module (mono_aot_module_System_Net_Security_info);
+   mono_aot_register_module (mono_aot_module_System_Net_ServicePoint_info);
+   mono_aot_register_module (mono_aot_module_System_Net_Sockets_info);
+   mono_aot_register_module (mono_aot_module_System_Net_WebClient_info);
+   mono_aot_register_module (mono_aot_module_System_Net_WebHeaderCollection_info);
+   mono_aot_register_module (mono_aot_module_System_Net_WebProxy_info);
+   mono_aot_register_module (mono_aot_module_System_Net_WebSockets_Client_info);
+   mono_aot_register_module (mono_aot_module_System_Net_WebSockets_info);
+   mono_aot_register_module (mono_aot_module_System_Net_info);
+   mono_aot_register_module (mono_aot_module_System_Numerics_Vectors_info);
+   mono_aot_register_module (mono_aot_module_System_Numerics_info);
+   mono_aot_register_module (mono_aot_module_System_ObjectModel_info);
+   mono_aot_register_module (mono_aot_module_System_Private_DataContractSerialization_info);
+   mono_aot_register_module (mono_aot_module_System_Private_Uri_info);
+   mono_aot_register_module (mono_aot_module_System_Private_Xml_Linq_info);
+   mono_aot_register_module (mono_aot_module_System_Private_Xml_info);
+   mono_aot_register_module (mono_aot_module_System_Reflection_DispatchProxy_info);
+   mono_aot_register_module (mono_aot_module_System_Reflection_Emit_ILGeneration_info);
+   mono_aot_register_module (mono_aot_module_System_Reflection_Emit_Lightweight_info);
+   mono_aot_register_module (mono_aot_module_System_Reflection_Emit_info);
+   mono_aot_register_module (mono_aot_module_System_Reflection_Extensions_info);
+   mono_aot_register_module (mono_aot_module_System_Reflection_Metadata_info);
+   mono_aot_register_module (mono_aot_module_System_Reflection_Primitives_info);
+   mono_aot_register_module (mono_aot_module_System_Reflection_TypeExtensions_info);
+   mono_aot_register_module (mono_aot_module_System_Reflection_info);
+   mono_aot_register_module (mono_aot_module_System_Resources_Reader_info);
+   mono_aot_register_module (mono_aot_module_System_Resources_ResourceManager_info);
+   mono_aot_register_module (mono_aot_module_System_Resources_Writer_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_CompilerServices_Unsafe_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_CompilerServices_VisualC_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Extensions_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Handles_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_InteropServices_JavaScript_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_InteropServices_RuntimeInformation_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_InteropServices_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Intrinsics_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Loader_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Numerics_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Serialization_Formatters_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Serialization_Json_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Serialization_Primitives_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Serialization_Xml_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_Serialization_info);
+   mono_aot_register_module (mono_aot_module_System_Runtime_info);
+   mono_aot_register_module (mono_aot_module_System_Security_AccessControl_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Claims_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Cryptography_Algorithms_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Cryptography_Cng_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Cryptography_Csp_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Cryptography_Encoding_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Cryptography_OpenSsl_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Cryptography_Primitives_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Cryptography_X509Certificates_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Cryptography_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Principal_Windows_info);
+   mono_aot_register_module (mono_aot_module_System_Security_Principal_info);
+   mono_aot_register_module (mono_aot_module_System_Security_SecureString_info);
+   mono_aot_register_module (mono_aot_module_System_Security_info);
+   mono_aot_register_module (mono_aot_module_System_ServiceModel_Web_info);
+   mono_aot_register_module (mono_aot_module_System_ServiceProcess_info);
+   mono_aot_register_module (mono_aot_module_System_Text_Encoding_CodePages_info);
+   mono_aot_register_module (mono_aot_module_System_Text_Encoding_Extensions_info);
+   mono_aot_register_module (mono_aot_module_System_Text_Encoding_info);
+   mono_aot_register_module (mono_aot_module_System_Text_Encodings_Web_info);
+   mono_aot_register_module (mono_aot_module_System_Text_Json_info);
+   mono_aot_register_module (mono_aot_module_System_Text_RegularExpressions_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_Channels_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_Overlapped_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_Tasks_Dataflow_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_Tasks_Extensions_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_Tasks_Parallel_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_Tasks_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_Thread_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_ThreadPool_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_Timer_info);
+   mono_aot_register_module (mono_aot_module_System_Threading_info);
+   mono_aot_register_module (mono_aot_module_System_Transactions_Local_info);
+   mono_aot_register_module (mono_aot_module_System_Transactions_info);
+   mono_aot_register_module (mono_aot_module_System_ValueTuple_info);
+   mono_aot_register_module (mono_aot_module_System_Web_HttpUtility_info);
+   mono_aot_register_module (mono_aot_module_System_Web_info);
+   mono_aot_register_module (mono_aot_module_System_Windows_info);
+   mono_aot_register_module (mono_aot_module_System_Xml_Linq_info);
+   mono_aot_register_module (mono_aot_module_System_Xml_ReaderWriter_info);
+   mono_aot_register_module (mono_aot_module_System_Xml_Serialization_info);
+   mono_aot_register_module (mono_aot_module_System_Xml_XDocument_info);
+   mono_aot_register_module (mono_aot_module_System_Xml_XPath_XDocument_info);
+   mono_aot_register_module (mono_aot_module_System_Xml_XPath_info);
+   mono_aot_register_module (mono_aot_module_System_Xml_XmlDocument_info);
+   mono_aot_register_module (mono_aot_module_System_Xml_XmlSerializer_info);
+   mono_aot_register_module (mono_aot_module_System_Xml_info);
+   mono_aot_register_module (mono_aot_module_System_info);
+   mono_aot_register_module (mono_aot_module_WindowsBase_info);
+   mono_aot_register_module (mono_aot_module_mscorlib_info);
+   mono_aot_register_module (mono_aot_module_netstandard_info);
+   mono_aot_register_module (mono_aot_module_System_Private_CoreLib_info);
+   mono_aot_register_module (mono_aot_module_Microsoft_MacCatalyst_info);

 }

 void xamarin_register_assemblies_impl ()
 {
    GCHandle exception_gchandle = INVALID_GCHANDLE;
+   xamarin_open_and_register ("Microsoft.MacCatalyst.dll", &exception_gchandle);
+   xamarin_process_managed_exception_gchandle (exception_gchandle);

 }

@@ -40,6 +382,7 @@
 };
 void xamarin_setup_impl ()
 {
+   mono_jit_set_aot_mode (MONO_AOT_MODE_FULL);
    xamarin_invoke_registration_methods ();
    xamarin_libmono_native_link_mode = XamarinNativeLinkModeDynamicLibrary;
    xamarin_runtime_libraries = xamarin_runtime_libraries_array;
@@ -48,7 +391,7 @@
    xamarin_executable_name = "sdk.dll";
    mono_use_llvm = FALSE;
    xamarin_log_level = 0;
-   xamarin_arch_name = "x86_64";
+   xamarin_arch_name = "arm64";
    xamarin_marshal_objectivec_exception_mode = MarshalObjectiveCExceptionModeThrowManagedException;
    xamarin_debug_mode = TRUE;
    setenv ("MONO_GC_PARAMS", "major=marksweep", 1);

Finally I started the app from the console, not the IDE

open ./sdk/bin/Debug/net7.0-maccatalyst/maccatalyst-arm64/sdk.app

and that seems to work fine 😮

Which means the binary itself is fine - but makes me wonder even more what can be happening ?!?

jeromelaban commented 1 year ago

Does this look to point at a macOS issue itself? Could it be related to some sort of "shell" environment setup?

spouliot commented 1 year ago

Does this look to point at a macOS issue itself?

That was my initial guess since it looked to be an arch specific issue. However it worked when using the MS SDK alone... so there's something else "in play" here.

Could it be related to some sort of "shell" environment setup?

Maybe but I doubt it since it works with Rosetta (x64) from the same IDE, so the execution environment (as far as I provide it) would be identical.

spouliot commented 1 year ago

Capturing [1] and comparing the view hierarchy (using Xcode) for both arm64 and x64 executables produced the same result.

[1] https://platform.uno/docs/articles/uno-development/debugging-inspect-visual-tree.html?q=xcode#ios

This makes (some) sense as the control focus works (if you click inside the textbox using the mouse) so the problem really seems limited to keyboard events (and not the views).

Inspecting the runtime visual tree of an Uno app

x64 (working)

working-x64

arm64 (not working)

not-working-arm64

spouliot commented 1 year ago

Comparing console logs I can see, on arm64 started with the debugger, a few

error 13:11:25.959184-0500 sdk View <(null):0x0> does not conform to UITextInput protocol

lines that are not present in the arm64 version started from the command-line.

The location of those messages hints this is likely the problem. However the logs message are not very helpful.

It's unclear (found nothing at startup) how the debugger could have this effect on the app.

spouliot commented 1 year ago

That debugging issue was a red herring :-(

The debugging path changed (while trying workarounds) so the binaries were not identical. After rebuilding the new binaries they behave identically between the debugger and the command-line executions (but still different between x86 and arm64).

Now I have to re-compare the logs between the x86 and arm64 - but they should be identical, IOW I still expect to see a problem with UITextInput on arm64 only... :-(

spouliot commented 1 year ago

If I add the following to MainPage the app

        public override void PressesBegan (NSSet<UIPress> presses, UIPressesEvent evt)
        {
            base.PressesBegan(presses, evt);
        }

and type anything inside the web view text box, I'll hit my breakpoint on arm64, which does not display the text.

However it won't hit the breakpoint on x64 (which works as expected), so the WKWebView control process the key events itself.

Something is not chaining up properly but is not leaving much hints about it. Other stuff, like contextual menu to copy/paste text, are working as expected.

spouliot commented 1 year ago

Using

            this.AddSubview(webView);

instead of

            Content = webView;

does not change the behaviour... which kind of exclude most of the Uno specific code.

Eilon commented 1 year ago

Hi Uno folks, I work at Microsoft on .NET MAUI and Blazor Hybrid and we're having what seems to be the exact same issue with WKWebView on MacCatalyst. I reproed the same issue using Xcode and Swift to build a MacCatalyst app, just to make sure it wasn't an issue in the .NET layer (it wasn't). I filed an Apple Feedback issue with a detailed bug report and repro steps.

You can see a bit more on this issue: https://github.com/dotnet/maui/issues/13934#issuecomment-1480380796

The Apple Feedback issue ID is FB12076485 (though I don't think it's publicly visible anywhere).

spouliot commented 1 year ago

Thanks for sharing this @Eilon!

My test cases with the MS SDK and Xcode/ObjC were working fine - but they were much simpler that the Uno version.

though I don't think it's publicly visible anywhere

No, they are not 😞

Eilon commented 1 year ago

Thanks for sharing this @Eilon!

You're welcome! 😄

My test cases with the MS SDK and Xcode/ObjC were working fine - but they were much simpler that the Uno version.

And that was on MacCatalyst (not macOS)?

I was hoping that the problem was on "our" side so that we had a chance of fixing it ourselves, but given that my Swift/MacCatalyst repro is so trivial (literally like 20 lines of mostly uninteresting code), I concluded the issue was on Apple's side. Of course, it's entirely possible that the control is simply being used incorrectly, but I found that on iPadOS the exact same project and code work fine (in the iPad Simulator, using my MacBook's physical keyboard). So that leads me to believe that the project and code are just fine, but that WKWebView on MacCatalyst has some internal issue.

spouliot commented 1 year ago

And that was on MacCatalyst (not macOS)?

sadly yes 😢 Catalyst on arm64. Here's the (dotnet) SDK version, with some typing.

Screenshot 2023-03-23 at 1 34 56 PM

I was hoping that the problem was on "our" side

me too... we might have to wait for a new version of macOS to get the fix - unless a workaround exists is found.

Eilon commented 1 year ago

@spouliot just to make sure I understand, you had MacCatalyst w/ WKWebView working on an arm64 machine? My MacBook is x64, and it didn't work. Perhaps there's some issue there?

spouliot commented 1 year ago

@Eilon yes, the screenshot is a catalyst app, built with the plain dotnet SDK for arm64 and executed on an Apple Silicon (M2) Mac. It works.

The source is basically

using WebKit;

namespace sdk;

[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate {
    public override UIWindow? Window {
        get;
        set;
    }

    public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
    {
        // create a new window instance based on the screen size
        Window = new UIWindow (UIScreen.MainScreen.Bounds);

        // create a UIViewController with a single UILabel
        var vc = new UIViewController ();

        var webView = new WKWebView (UIScreen.MainScreen.Bounds, new WKWebViewConfiguration ());
        webView.LoadRequest (new NSUrlRequest (new NSUrl ("https://github.com")));

        vc.View!.AddSubview (webView);

        Window.RootViewController = vc;

        // make the window visible
        Window.MakeKeyAndVisible ();

        return true;
    }
}

Doing something similar with Uno does not work - but the executable is a lot larger and I've been hoping to pinpoint (without success so far) what the difference could be between the apps.

I would have to dig around to find it but my ObjC sample (again catalyst/arm64) was also working properly...

Eilon commented 1 year ago

Yeah my Swift code looks quite similar at https://github.com/Eilon/MacCatalystWebViewKeyboard/blob/main/MacCatalystWebViewKeyboard/ContentView.swift#L11-L24

struct ContentView: View {
    @StateObject var model = WebViewModel()

    var body: some View {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundColor(.accentColor)
            Text("Hello, world!")
            WebView(webView: model.webView)
        }
        .padding()
    }
}

In my demo it loads some static HTML into the webview, but it's the same if you point it at a URL with HTML inputs.

I just noticed your earlier comment about x64 vs. arm64 and I wonder if that's the issue? Do we have any examples of it not working on x64? In your Uno case, was it maybe running an x64 build on your arm64 CPU?

GitHub
MacCatalystWebViewKeyboard/ContentView.swift at main · Eilon/MacCatalystWebViewKeyboard
MacCatalyst WKWebView keyboard problem repro. Contribute to Eilon/MacCatalystWebViewKeyboard development by creating an account on GitHub.
spouliot commented 1 year ago

Do we have any examples of it not working on x64?

Not on my side. If I build for x64 and run it on any of my arm64 Macs then it works fine. I do not have a x64 Mac anymore to see if Rosetta might be playing a part into this (it would be weird, but it already is).

Note that the original report (from @edoust) mentioned this failed on x64...

This happens for both maccatalyst-arm64 as well as maccatalyst-x64

but a later comment says it was not reproducible on x64 anymore ?!?

On x64 it doesn't seem to happen anymore... I am also on macOS 13.1

Re-reading your maui bug report I see now that there's no mention of the architecture 😕

In your Uno case, was it maybe running an x64 build on your arm64 CPU?

I tried both arches on my Apple Silicon Macs. A x64 binary works fine, an arm64 binary does not work.

Eilon commented 1 year ago

Here's my summary of what various people have said about where it works and where it doesn't (mostly just the two of us though 😄 ):

Within this issue:

And an Apple Forum post:

Unfortunately in the .NET MAUI issues people didn't specify the platform, but I'll try to find out.

For me, macOS Venture on Intel x64 hardware did not work.

But so far what's most interesting to me is the difference you were seeing on the same machine between Obj-C and Uno, both on MacCatalyst, both with arm64 binaries. How could those be different?

Mac Catalyst WKWebView keyDown nev… | Apple Developer Forums
spouliot commented 1 year ago

For me, macOS Venture on Intel x64 hardware did not work.

So, no hardware intersection between us then.

@dr1rrb what kind (arch) of a Mac did you use when you tried to duplicate the issue ?

between Obj-C and Uno, both on MacCatalyst, both with arm64 binaries. How could those be different?

The Uno app is much larger (than both the dotnet SDK version and the ObjC version), executes more code and links with many other native frameworks. It also has all the initialization to make the dotnet app interop with ObjC... Those are all places where bugs have been found in the past 😄

I spend quite some time reviewing the (Xamarin) generated code (e.g. registrar.mm) and also reading the runtime logs without finding a smoking gun 😞

I'm sure there's something, somewhere and I likely have missed it - and will, shamefully bang my head on the wall several time once it's found... At the same time I'm sure there's something wrong on Apple side, but it's unclear how we are, only sometimes, tripping over it.

Eilon commented 1 year ago

If possible, could you try running my Swift example on your Apple arm64 machine? This here: https://github.com/Eilon/MacCatalystWebViewKeyboard

It's a default Swift app I made in Xcode, and then found some code that creates a webview, and then I had it load static HTML. That 100% non-Microsoft app (no .NET, no C#, no Xamarin/MAUI etc.) doesn't work on my Intel x64 Venture machine on MacCatalyst. The exact same project works fine on iPadOS.

I wonder if that repros on your Apple Silicon on either MacCat or iPadOS?

GitHub
GitHub - Eilon/MacCatalystWebViewKeyboard: MacCatalyst WKWebView keyboard problem repro
MacCatalyst WKWebView keyboard problem repro. Contribute to Eilon/MacCatalystWebViewKeyboard development by creating an account on GitHub.
Eilon commented 1 year ago

I'm sure there's something, somewhere and I likely have missed it - and will, shamefully bang my head on the wall several time once it's found... At the same time I'm sure there's something wrong on Apple side, but it's unclear how we are, only sometimes, tripping over it.

And I 100% agree with this and will join you 😄

spouliot commented 1 year ago

Swift app built for arm64 and running on arm64 -> works!

Screenshot 2023-03-23 at 5 01 46 PM

For some reason the app crash (very early at startup) when I build for x64

https://gist.github.com/spouliot/4ef368f9717f3d66adad96e59f436730

I got to go now - but I'll look at why this crashed asap

Gist
gist:4ef368f9717f3d66adad96e59f436730
GitHub Gist: instantly share code, notes, and snippets.
Eilon commented 1 year ago

I've asked .NET MAUI users what architecture they're hitting the issue on, so we'll see what people say:

dr1rrb commented 1 year ago

@dr1rrb what kind (arch) of a Mac did you use when you tried to duplicate the issue ?

I was testing on an x64 (Intel core i7) Mac with Ventura 13.1

spouliot commented 11 months ago

@Eilon have you ever heard back from Apple about this ? thanks!

Eilon commented 10 months ago

@Eilon have you ever heard back from Apple about this ? thanks!

I just checked the Apple Feedback Assistant item and unfortunately there are no updates on it.

git-achern19 commented 1 day ago

@Eilon Any update on this issue or workaround? After almost a year since your last update, it seems pretty bewildering to me that apple would let such a fundamental issue exist for so long. Why would anyone even want to use a Catalyst app when it doesn't provide the basic functionality of keyboard navigation?