Repository navigation
Labels
difficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.kind/bugSomething isn't workingtriage/untriagedIndicates an issue requires triaging or verification
Description
Current behavior
I was testing Uno 6.1.0-dev.167 to see if something I was tracking was fixed. Usually I can just build my application and run it on both Windows and Linux-arm64, just copying the full bin folder. With the upgrade to this test version I'm getting an exception right at the start, which I believe is related to this commit: f0c8d93 / PR #20443
Should there perhaps be a check if we're running on Windows? I tried to comment out UseWin32, but it still crashes (since there is a static constructor where this is called).
Exception:
Unhandled exception. System.TypeInitializationException: The type initializer for '<Module>' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'USER32.dll' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/root/VSLinuxDbg/DMXCore100/runtimes/linux-arm64/native/USER32.dll.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/9.0.4/USER32.dll.so: cannot open shared object file: No such file or directory
/root/VSLinuxDbg/DMXCore100/USER32.dll.so: cannot open shared object file: No such file or directory
/root/VSLinuxDbg/DMXCore100/runtimes/linux-arm64/native/libUSER32.dll.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/9.0.4/libUSER32.dll.so: cannot open shared object file: No such file or directory
/root/VSLinuxDbg/DMXCore100/libUSER32.dll.so: cannot open shared object file: No such file or directory
/root/VSLinuxDbg/DMXCore100/runtimes/linux-arm64/native/USER32.dll: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/9.0.4/USER32.dll: cannot open shared object file: No such file or directory
/root/VSLinuxDbg/DMXCore100/USER32.dll: cannot open shared object file: No such file or directory
/root/VSLinuxDbg/DMXCore100/runtimes/linux-arm64/native/libUSER32.dll: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/9.0.4/libUSER32.dll: cannot open shared object file: No such file or directory
/root/VSLinuxDbg/DMXCore100/libUSER32.dll: cannot open shared object file: No such file or directory
at Windows.Win32.PInvoke.<SetProcessDpiAwarenessContext>g__LocalExternFunction|240_0(DPI_AWARENESS_CONTEXT value)
at Windows.Win32.PInvoke.<SetProcessDpiAwarenessContext>g__LocalExternFunction|240_0(DPI_AWARENESS_CONTEXT value)
at Windows.Win32.PInvoke.SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT value)
at DpiBootstrap.Init()
at .cctor()
--- End of inner exception stack trace ---
at DMXCore.DMXCore100.Program.Main(String[] args)
Aborted
Startup code:
var host = UnoPlatformHostBuilder.Create()
.App(() => new App())
.UseX11()
.UseWin32()
.Build();
Expected behavior
App should start
How to reproduce it (as minimally and precisely as possible)
No response
Workaround
No response
Works on UWP/WinUI
None
Environment
Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
NuGet package version(s)
"Uno.Sdk": "6.1.0-dev.167"
Renderer
- Skia
- Native
Affected platforms
Desktop (X11)
IDE
Visual Studio 2022
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
No response
Metadata
Metadata
Assignees
Labels
difficulty/tbdCategorizes an issue for which the difficulty level needs to be defined.kind/bugSomething isn't workingtriage/untriagedIndicates an issue requires triaging or verification
Activity
[-]Crash on Linux when UseWin32 is in host builder (DpiBootstrap)[/-][+]Crash on Linux due to DpiBootstrap static constructor[/+]HakanL commentedon May 23, 2025
The last working version was 6.1.0-dev.152 (which unfortunately doesn't have the fix I was looking to test, #20506).
jeromelaban commentedon May 24, 2025
Thanks, this is an interesting issue.
Our CI runs using Linux and is not failing this particular condition. We'll need to enhance our validations to catch this.
Youssef1313 commentedon May 25, 2025
@jeromelaban This is not caught in CI because SamplesApp avoids to load Win32 uno runtime assembly unless running on Windows:
uno/src/SamplesApp/SamplesApp.Skia.Generic/Program.cs
Lines 61 to 73 in 4c0b7f0
HakanL commentedon May 25, 2025
I tried that initially and it didn't work, it seems that at least for me, just having
UseWin32()in the code causes the static constructor to be called (even ifUseWin32isn't called). Also, I used to be able to doUseWin32even when running on Linux (just as I still haveUseX11()when running in Windows).HakanL commentedon May 27, 2025
I can confirm this is now working in Uno.Sdk version 6.1.0-dev.179.
chore: Avoid module initializers
chore: Avoid module initializers
chore: module initializers and OS-specific code
chore: module initializers and OS-specific code
github-actions commentedon May 5, 2026
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests.