Open Jnschrber opened 1 week ago
Can you try starting it from inside a terminal session (shift + right-click on the folder -> Open powershell -> .\tauri-app.exe
).
This way you won't lose the error message if there's any.
In theory it should still be supported by webview2 and rust.
I had already done that. However, there is no error message here either. Version of installed WebView2: 130.0.2849.80
hmm, that's unfortunate. What about a debug build via tauri build --debug
? Should behave like the release build but keeping the console attached. I doubt it's any better but still worth a try imo
As I build Tauri with Cargo, the standard build is a debug version. Nevertheless, I have just built a release version with cargo build --release
. Now I have both builds. When executing the release version, no ApplicationError is written to the Windows 10 EventLogs. When executing the debug version, the error is written to the EventLogs as described in the description.
Hello, I had a similar problem since switching to version 2 of tauri:.
My application compiled by tauri build --target i686-pc-windows-msvc crashed at startup on my Windows 2016 workstations
with the same message: "Application Error..."
After doing a fork of tauri and tao i put in comment this line: (tao\src\platform_impl\windows\event_loop.rs)
super::dark_mode::allow_dark_mode_for_app(true);
My application doesnt crash anymore.
I hope this can help someone.
@Michto8 thanks for tracking this down, since you have a Windows 10 system (and it would take me a while to setup one), could you try to pin it down to an exact line in tao\src\platform_impl\windows\dark_mode.rs
?
I will try on windows 2016 and windows 2010.
WIN10_BUILD_VERSION return me 14393. The program call ALLOW_DARK_MODE_FOR_APP and the application hang.
But if i return None in this function i dont have any error
`
static ALLOW_DARK_MODE_FOR_APP: Lazy<Option
println!("NO lambda ALLOW_DARK_MODE_FOR_APP"); return None;
if HMODULE(*HUXTHEME as _).is_invalid() { return None; }
GetProcAddress( HMODULE(HUXTHEME as _), PCSTR::from_raw(UXTHEME_ALLOWDARKMODEFORAPP_ORDINAL as usize as mut _), ) .map(|handle| std::mem::transmute(handle)) }); ` Im running my program on 32 bits so uxtheme.dll are loaded from c:\Windows\Syswow64. The ordinal number for UXTHEME_ALLOWDARKMODEFORAPP_ORDINAL are 135. If i inspect functions in this dll with dependency walker this dont seem to match with the function to call.
https://stackoverflow.com/questions/53501268/win10-dark-theme-how-to-use-in-winapi
https://learn.microsoft.com/en-us/cpp/build/getprocaddress?view=msvc-170
Because you are calling the DLL function through a pointer and there is no compile-time type checking, make sure that the parameters to the function are correct so that you do not overstep the memory allocated on the stack and cause an access violation.
Hi, I have also just managed to create a working Tauri2 App with this hint.
Hello, I had a similar problem since switching to version 2 of tauri:. My application compiled by tauri build --target i686-pc-windows-msvc crashed at startup on my Windows 2016 workstations with the same message: "Application Error..." After doing a fork of tauri and tao i put in comment this line: (tao\src\platform_impl\windows\event_loop.rs)
super::dark_mode::allow_dark_mode_for_app(true);
My application doesnt crash anymore. I hope this can help someone.
What I have figured out so far is the following:
The line responsible for the app to crash on startup in tao\src\platform_impl\windows\dark_mode.rs
is line 84. See: https://github.com/tauri-apps/tao/blob/fa9aaa6066dcc0316d57038fc1b1e3353dc5c3e7/src/platform_impl/windows/dark_mode.rs#L84C1-L84C59
unsafe { _allow_dark_mode_for_app(is_dark_mode) };
When I disable execution of this particular line, the app starts normally and as far as I can tell works properly.
What I also found out is that there is an attribute DARK_MODE_SUPPORTED
in the file, which indicates that Windows versions lower than 17763 are not supporting dark mode. However, this attribute is not taken into account in the allow_dark_mode_for_app()
function.
static DARK_MODE_SUPPORTED: Lazy<bool> = Lazy::new(|| {
// We won't try to do anything for windows versions < 17763
// (Windows 10 October 2018 update)
match *WIN10_BUILD_VERSION {
Some(v) => v >= 17763,
None => false,
}
});
If the WIN10_BUILD_VERSION
is smaller than 18362 it executes the line 84 regardless wether DARK_MODE_SUPPORTED
is true or false. Therefore I added another condition to check wether the DARK_MODE_SUPPORTED
is true to only execute line 84 in that case. (see below)
if let Some(ver) = *WIN10_BUILD_VERSION {
if ver < 18362 {
if let Some(_allow_dark_mode_for_app) = *ALLOW_DARK_MODE_FOR_APP {
unsafe { _allow_dark_mode_for_app(is_dark_mode) };
}
} else if let Some(_set_preferred_app_mode) = *SET_PREFERRED_APP_MODE {
let mode = if is_dark_mode {
PreferredAppMode::AllowDark
} else {
PreferredAppMode::Default
};
unsafe { _set_preferred_app_mode(mode) };
}
}
changed to:
if let Some(ver) = *WIN10_BUILD_VERSION {
// in case Windows 10 Build version < 18362, we have to call a special command (_allow_dark_mode_for_app)
if ver < 18362 {
// but only call that command if the dark mode is supported...
if *DARK_MODE_SUPPORTED {
if let Some(_allow_dark_mode_for_app) = *ALLOW_DARK_MODE_FOR_APP {
unsafe { _allow_dark_mode_for_app(is_dark_mode) };
}
}
} else if let Some(_set_preferred_app_mode) = *SET_PREFERRED_APP_MODE {
let mode = if is_dark_mode {
PreferredAppMode::AllowDark
} else {
PreferredAppMode::Default
};
unsafe { _set_preferred_app_mode(mode) };
}
}
Would be great if someone with more background knowledge could check that fix suggested, and then create a pull request for the tao repository.
Describe the bug
Tauri2 is not starting on Windows 10 LTSC 2016. When executing the .exe it immediately terminates without any error message. When checking the Windows 10 EventLogs, the following Application Error is shown:
https://github.com/user-attachments/assets/1e5f7f1c-7c16-49c5-8612-e26f92f99353
Reproduction
Create a new sample Project with:
Build the Project:
Expected behavior
Tauri should start and open the sample GUI.
Full
tauri info
outputStack trace
No response
Additional context
The exact same application is working fine on: