Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skia rendering issues in Windows 10 and Windows 11 in VMWare #17526

Open
MartinZikmund opened this issue Jul 15, 2024 Discussed in #17411 · 9 comments
Open

Skia rendering issues in Windows 10 and Windows 11 in VMWare #17526

MartinZikmund opened this issue Jul 15, 2024 Discussed in #17411 · 9 comments

Comments

@MartinZikmund
Copy link
Member

Discussed in #17411

Originally posted by lemalcs July 8, 2024
Hello, I have a Skia project built with Uno Platform but I'm finding rendering issues when running it on some Windows versions.

When you click outside the dark rectangle, it disappears, but shows up again, when you focus on the text boxes.

The expected behavior is that the whole window background is light or dark, depending on the current OS theme.

On Windows 10 x64 Version 1507 (RTM) (OS build 10240)
image

On Windows 11 Pro (x64) Version 23H2 build 22631.3593:
image

Interestingly on Windows 7 SP1 x64, it is rendered with any issues:
image

This is the command I used to publish the project (.NET desktop runtime 8 dependant):

dotnet publish -f net8.0-desktop -c Release -o ./publish

My development environment

  • Uno Platform 5.2.56.70
  • Visual Studio 2022 (64 bits) Version 17.10.3
  • Windows 11 Pro (x64) Version 23H2 build 22631.3737

dotnet --list-sdks:

5.0.416 [C:\Program Files\dotnet\sdk]
7.0.120 [C:\Program Files\dotnet\sdk]
8.0.106 [C:\Program Files\dotnet\sdk]
8.0.206 [C:\Program Files\dotnet\sdk]
8.0.300 [C:\Program Files\dotnet\sdk]
8.0.302 [C:\Program Files\dotnet\sdk]
9.0.100-preview.5.24307.3 [C:\Program Files\dotnet\sdk]

When I run the same application in my development environment, it renders as expected:

With dark theme
image

With light theme
image

Here is the sample project I used for the tests; it's an almost fresh project I just added two text boxes, two labels, and one button.

Is there any workaround for this problem or something I'm missing around?

I appreciate any help you can provide.

Thanks in advance.

@jeromelaban
Copy link
Member

@MartinZikmund do you know if it still happens? I don't recall seeing this recently.

@MartinZikmund
Copy link
Member Author

@lemalcs can you please test against the latest releases of Uno Platform to see if this is still a problem?

@MartinZikmund MartinZikmund added the triage/needs-information Indicates an issue needs more information in order to work on it. label Nov 19, 2024
@github-actions github-actions bot removed the triage/needs-information Indicates an issue needs more information in order to work on it. label Nov 19, 2024
@lemalcs
Copy link

lemalcs commented Nov 23, 2024

Hi @MartinZikmund , I made these upgrades to the sample project:

  • Uno SDK: 5.5.43
  • .NET 9.0

I built the project using Visual Studio 2022 Preview 17.13.0.
I published the application with:

dotnet publish -f net9.0-desktop -r win-x64 -p:SelfContained=true

However, there are still issues in rendering.

  • Text boxes change to a black background when focused,
  • Buttons don't have borders.

The same happens with fresh Uno projects.

I'm using Virtual Machines to test the application.

On Windows 10 x64 (RTM) (Virtual machine)

image

On Windows 11 x64 (RTM) (Virtual machine)

image

On Windows 7 x64 (Virtual machine)

The application crashed with this message:

Application: UnoAppSkiaDesktop.exe
CoreCLR Version: 9.0.24.52809
.NET Version: 9.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for 'Windows.Globalization.ApplicationLanguages' threw an exception.
 ---> System.DllNotFoundException: Unable to load DLL 'winlangdb.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
   at Windows.System.UserProfile.GlobalizationPreferences.NativeMethods.EnsureLanguageProfileExists()
   at Windows.System.UserProfile.GlobalizationPreferences.GetWinUserLanguageList() in /__w/1/s/src/Uno.UWP/System/UserProfile/GlobalizationPreferences.cs:line 33
   at Windows.System.UserProfile.GlobalizationPreferences.get_Languages() in /__w/1/s/src/Uno.UWP/System/UserProfile/GlobalizationPreferences.cs:line 26
   at Windows.Globalization.ApplicationLanguages.ApplyLanguages() in /__w/1/s/src/Uno.UWP/Globalization/ApplicationLanguages.cs:line 157
   at Windows.Globalization.ApplicationLanguages..cctor() in /__w/1/s/src/Uno.UWP/Globalization/ApplicationLanguages.cs:line 63

On Development Machine

I used a machine with Windows 11 23H2 to build and test the project. Here, the application renders well.
image

Thanks in advance for your help.

@jeromelaban
Copy link
Member

Thanks for the update. Could you provide the VM software that you are using? This looks like an incorrect OpenGL implementation of some kind.

@lemalcs
Copy link

lemalcs commented Nov 26, 2024

Thanks for the update. Could you provide the VM software that you are using? This looks like an incorrect OpenGL implementation of some kind.

I'm using VMWare Workstation 17 Pro, version 17.0.0 build-20800274.

@jeromelaban
Copy link
Member

Thanks. It is likely that VMWare contains faulty or outdated graphics drivers that cause this OpenGL issue to happen, we've seen that a while back for virtualbox and other related hypervisors.

Do you know if this happens in Hyper-V ?

@lemalcs
Copy link

lemalcs commented Nov 28, 2024

I tested the same application on Windows Sandbox, which comes with Windows 11, and it renders the application correctly:

image

Is it a valid test of Hyper-V?

@jeromelaban
Copy link
Member

Windows Sandbox is using the same hardware acceleration that the host machine is using, so it's likely that the rendering will be working fine.

Searching for it, we had a similar issue (#10484) when using GTK on VMs. One if the ways to work around it is to use software rendering with this in your Program.cs:

if (host is UI.Runtime.Skia.Wpf.WpfHost wpf)
{
	wpf.RenderSurfaceType = UI.Runtime.Skia.Wpf.RenderSurfaceType.Software
}

host.Run();

@jeromelaban jeromelaban changed the title Skia rendering issues in Windows 10 and Windows 11 Skia rendering issues in Windows 10 and Windows 11 in VMWare Nov 28, 2024
@lemalcs
Copy link

lemalcs commented Nov 29, 2024

I applied the software rendering as workaround for the WpfHost and it fixes the rendering issue in both virtual machines:

Windows 11 x64 (Virtual Machine)

image

Windows 10 x64 (Virtual Machine)

image

I verified that disabling the 3D rendering feature in VMware Workstation also fixes the issue without any code changes to the application.
image

For now, software rendering fixes the rendering issue regarding whether the 3D rendering feature is enabled or not.

Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants