tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
82.22k stars 2.47k forks source link

[bug] the webview crashes on release target #7407

Open Kiyozz opened 1 year ago

Kiyozz commented 1 year ago

Describe the bug

I'm building an application that will be used by Skyrim Modders. The application is launched through an app called Mod Organizer 2 (this app uses something called vfs for virtual filesystem).

I built the app first with electron 3 years ago. Today, I want to migrate to tauri to reduce the bundle size and memory usage.

When starting the app exe from Windows Explorer, the Webview starts and the application is working.

When starting the app with Mod Organizer 2, the Webview starts and you can see the app menu, a blank window app and finally the app crashes with the below stack trace.

You could say

"ok, this is a problem with Mod Organizer"

but why when I built the app with electron, I did not have this problem.

I need help debugging this.uses

Reproduction

To reproduce, make sure to have all Tauri requisites.

Node 18, pnpm 8.

You will need an MO2 environment and Skyrim LE/SE/AE game.

Inside MO2, you need to have an executable, for example ↓

add_exe

repository: https://github.com/Kiyozz/papyrus-compiler-app-tauri and branch main.

  1. pnpm i
  2. pnpm tauri:build
  3. start MO2
  4. start the release target PCA.exe with MO2

Expected behavior

The webview starts successfully.

Platform and versions

[✔] Environment
    - OS: Windows 10.0.22621 X64
    ✔ WebView2: 114.0.1823.67
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.70.0 (90c541806 2023-05-31)
    ✔ Cargo: 1.70.0 (ec8a8a0ca 2023-04-25)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 18.16.1
    - pnpm: 8.6.7
    - yarn: 1.22.19
    - npm: 9.5.1

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.2.1
    - wry [RUST]: 0.24.3
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: 1.4.0
    - @tauri-apps/cli [NPM]: 1.4.0

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

[0711/235617.970:ERROR:check.cc(239)] Check failed: false. 
[0711/235619.250:ERROR:check.cc(239)] Check failed: false. 
thread 'main' panicked at 'error while running PCA application: Runtime(CreateWebview(WebView2Error(WindowsError(Error { code: 0x8000FFFF, message: Défaillance irrémédiable }))))', src\main.rs:156:10
stack backtrace:
   0:     0x7ff756613a52 - std::backtrace_rs::backtrace::dbghelp::trace
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
   1:     0x7ff756613a52 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff756613a52 - std::sys_common::backtrace::_print_fmt
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys_common\backtrace.rs:65
   3:     0x7ff756613a52 - std::sys_common::backtrace::_print::impl$0::fmt
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys_common\backtrace.rs:44
   4:     0x7ff75663712b - core::fmt::write
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\fmt\mod.rs:1254
   5:     0x7ff75660e0ea - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\io\mod.rs:1698
   6:     0x7ff75661379b - std::sys_common::backtrace::_print
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys_common\backtrace.rs:47
   7:     0x7ff75661379b - std::sys_common::backtrace::print
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys_common\backtrace.rs:34
   8:     0x7ff75661653a - std::panicking::default_hook::closure$1
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:269
   9:     0x7ff7566161a0 - std::panicking::default_hook
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:288
  10:     0x7ff756616c16 - std::panicking::rust_panic_with_hook
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:691
  11:     0x7ff756616b0e - std::panicking::begin_panic_handler::closure$0
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:582
  12:     0x7ff7566146f9 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys_common\backtrace.rs:150
  13:     0x7ff756616820 - std::panicking::begin_panic_handler
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:578
  14:     0x7ff7566659a5 - core::panicking::panic_fmt
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\panicking.rs:67
  15:     0x7ff756665ec6 - core::result::unwrap_failed
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\result.rs:1687
  16:     0x7ff75618a15e - hashbrown::raw::RawTable<T,A>::find::{{closure}}::hbd65138ff87abba1
  17:     0x7ff75608bce6 - std::sys_common::backtrace::__rust_begin_short_backtrace::h087c7fe55efd3565
  18:     0x7ff75623fd9c - std::rt::lang_start::{{closure}}::haecab8e9fd2e039a
  19:     0x7ff75660742e - core::ops::function::impls::impl$2::call_once
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\ops\function.rs:287
  20:     0x7ff75660742e - std::panicking::try::do_call
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:485
  21:     0x7ff75660742e - std::panicking::try
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:449
  22:     0x7ff75660742e - std::panic::catch_unwind
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panic.rs:140
  23:     0x7ff75660742e - std::rt::lang_start_internal::closure$2
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\rt.rs:148
  24:     0x7ff75660742e - std::panicking::try::do_call
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:485
  25:     0x7ff75660742e - std::panicking::try
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:449
  26:     0x7ff75660742e - std::panic::catch_unwind
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panic.rs:140
  27:     0x7ff75660742e - std::rt::lang_start_internal
                               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\rt.rs:148
  28:     0x7ff75618b9bc - main
  29:     0x7ff75663fe24 - invoke_main
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  30:     0x7ff75663fe24 - __scrt_common_main_seh
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  31:     0x7ffb68c126ad - BaseThreadInitThunk
  32:     0x7ffb69e8a9f8 - RtlUserThreadStart


### Additional context

You may say that this is hard to reproduce because of the setup, but maybe someone comes across and help debug this!

Thanks you everyone that help into this!
FabianLars commented 1 year ago

Without looking too much into it (= without testing it myself) there are a few upstream issues with the same error code: https://github.com/MicrosoftEdge/WebView2Feedback/issues?q=0x8000FFFF+is%3Aissue - most seem to be permissions related, are you running mo as admin? The other issues don't seem related but hard to say rn 🤔

p.s. thx for the report :)

Kiyozz commented 1 year ago

MO2 is not started as admin, as everyone should 😝

I know, this is hard to test 🥲

Kiyozz commented 12 months ago

I just created an issue in the MO2 repository

here