uno
uno copied to clipboard
webView2 fails on linux platforms.
Current behavior 🐛
When I use webview2 component it works correctly on WIndow / Mac, however when I execute from linux-x64 platform I get the following error when I bring up the webview2 component.
(UnoApp60:161289): Gdk-CRITICAL **: 22:23:58.759: gdk_x11_window_get_xid: assertion 'GDK_IS_X11_WINDOW (window)' failed X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 3 (X_GetWindowAttributes) Resource id in failed request: 0x0 Serial number of failed request: 94 Current serial number in output stream: 95
The attached .zip file exhibits this issue. unzip file % cd UnoApp60\UnoApp60 $ dotnet run -f net9.0-desktop
Select Help->Whats new.
Expected behavior 🎯
WebView2 component working and showing the website content.
How to reproduce it (as minimally and precisely as possible) 🔬
No response
Workaround 🛠️
I open a browser to display the content if I am running on a LINUX platform.
Renderer 🎨
- [x] Skia
- [ ] Native
Affected platforms 📱💻🖥️
Desktop (Linux Framebuffer)
Uno.Sdk version (and other relevant versions) 📦
{ "msbuild-sdks": { "Uno.Sdk": "6.0.110" }, "sdk": { "allowPrerelease": false } }
IDE version 🧑💻
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.14.1
Anything else we need to know? 💬
No response
I somehow put the describtion of the issue into Chat GPT provided an answer; that webview2 is not supported on linux platforms and the recommend solution is to open the default browser for the platform. I wonder if sdk should provide a messages stating that is not supported versus a X11 specific error messages.
Thanks for the report. ChatGPT is unlikely to provide anything meaningful there :)
WebView2's implementation in Uno uses a linux specific implementation, but you may need to install specific packages before using it.
Let us know if that helps.
@jeromelaban - The linux specific libraries were already installed. Dont know if this makes a difference but I am using Ununtu 25.04 ( plucky ) as the OS.
As to chatGPT it was just an interesting answer and wondering how it determined the linux platforms were not supported using webview :)
It may be. We've tested on WSL 24.04, actual 24.04 Ubuntu and a few other earlier distros but there may be something specific to 25.04 that breaks. Are you able to test on another machine?
@jeromelaban I reinstalled ubuntu 24.04 on wsl2 and loaded dotnet and installed the required libraries + uno. And a created the default app it works correctly on windows however when I run on WSL2 it only has an empty translucent window. I also get the following error messages after a bit of time.
Exception thrown: 'Tmds.DBus.Protocol.DBusException' in System.Private.CoreLib.dll
Exception thrown: 'Tmds.DBus.Protocol.DBusException' in System.Private.CoreLib.dll
Exception thrown: 'Tmds.DBus.Protocol.DBusException' in System.Private.CoreLib.dll
Uno.WinUI.Runtime.Skia.X11.LinuxSystemThemeHelper: Error: Unable to observe the system theme. (DBus Settings error, see https://aka.platform.uno/x11-dbus-troubleshoot for troubleshooting information)
Tmds.DBus.Protocol.DBusException: org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.freedesktop.portal.Desktop': timed out (service_start_timeout=120000ms)
at Tmds.DBus.Protocol.DBusConnection.MyValueTaskSource`1.System.Threading.Tasks.Sources.IValueTaskSource<T>.GetResult(Int16 token)
at Tmds.DBus.Protocol.DBusConnection.CallMethodAsync[T](MessageBuffer message, MessageValueReader`1 valueReader, Object state)
at Tmds.DBus.Protocol.Connection.CallMethodAsync[T](MessageBuffer message, MessageValueReader`1 reader, Object readerState)
at Uno.WinUI.Runtime.Skia.X11.LinuxSystemThemeHelper.Init()
fail: Uno.WinUI.Runtime.Skia.X11.LinuxSystemThemeHelper[0]
Unable to observe the system theme. (DBus Settings error, see https://aka.platform.uno/x11-dbus-troubleshoot for troubleshooting information)
Tmds.DBus.Protocol.DBusException: org.freedesktop.DBus.Error.TimedOut: Failed to activate service 'org.freedesktop.portal.Desktop': timed out (service_start_timeout=120000ms)
at Tmds.DBus.Protocol.DBusConnection.MyValueTaskSource`1.System.Threading.Tasks.Sources.IValueTaskSource<T>.GetResult(Int16 token)
at Tmds.DBus.Protocol.DBusConnection.CallMethodAsync[T](MessageBuffer message, MessageValueReader`1 valueReader, Object state)
at Tmds.DBus.Protocol.Connection.CallMethodAsync[T](MessageBuffer message, MessageValueReader`1 reader, Object readerState)
at Uno.WinUI.Runtime.Skia.X11.LinuxSystemThemeHelper.Init()
Any ideas what I am missing... Note the dbus service running...
It looks like this is specifically a problem on (some) Wayland environments. The gtk crash indicates that the spawned gtk window is not an X11 window, but a wayland window. Somehow, I managed to get past the crash at some point, but the webview still only worked if you don't insert it into the uno window. The moment you do, the area occupied by the inserted webview is never filled in. Forcing GTK to use the X11 backend (with GDK_BACKEND=X11) crashes on startup (this is not uno-specific, but happens with all GTK3 and GTK4 apps). I'm not sure if that Ubuntu environment has a GTK build that was compiled without the X11 backend.
@ramezgerges I am trying to use webview2 in ubuntu 24.04.3 that is installed in dual-boot with Windows with uno 6.2.39 but ı have different errors looks like similar.
In vscode
fail: Uno.UI.WebView.Skia.X11.X11NativeWebView[0] SetScrollingEnabled is not supported on the X11 target. /usr/lib/x86_64-linux-gnu/webkit2gtk-4.1/WebKitNetworkProcess: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE /usr/lib/x86_64-linux-gnu/webkit2gtk-4.1/WebKitWebProcess: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE
In rider
(MyApp:20118): Gdk-CRITICAL **: 23:44:55.086: gdk_x11_window_get_xid: assertion 'GDK_IS_X11_WINDOW (window)' failed X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 3 (X_GetWindowAttributes) Resource id in failed request: 0x0 Serial number of failed request: 64 Current serial number in output stream: 65
Is there any development regarding this issue?
@mucahit-turhan I'm not sure about the symbol error in VSCode, but the one is rider is the same at the error shown earlier in the issue. You could try xhost +SI:localuser:$(id -un) to allow XWayland connections and also GDK_BACKEND=X11 to force GTK to use X11 instead of Wayland.