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

document that changing additional_browser_args require changing data_directory if multiple webviews will be opened #11144

Open
Elendiar opened this issue Sep 26, 2024 · 3 comments
Labels
type: documentation Need to update the API documentation

Comments

@Elendiar
Copy link

Describe the bug

Applying additional_browser_args, empty or not to any window builder during app_setup.

[2024-09-26][06:10:44][tauri_runtime_wry][ERROR] failed to create webview: WebView2 error: 
WindowsError(Error { code: HRESULT(0x8007139F), message: "The group or resource is not in the correct state to perform the requested operation." })

I create few windows during app setup, main, popover etc, and notice bugged behaviour when additional_browser_args applied to any on them.
For example, if use additional_browser_args("--enable-features=msWebView2EnableDraggableRegions --disable-features=ElasticOverscroll"), or .additional_browser_args("") to main window builder - i get HRESULT(0x8007139F) on any webview create from javascript frontend (ts/react).
But other windows, created from rust frontend works.
If i apply additional_browser_args to my secondary, popover window, webviews creates from js successfully, but interaction with popover webview, created from rust backend causes panic.

Applying additional_browser_args for both, main and popover window cause only failed to create webview: WebView2 error fro js, without panic.

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22631 x86_64 (X64)
    ✔ WebView2: 129.0.2792.52
    ✔ MSVC: Visual Studio Community 2022
    ✔ rustc: 1.83.0-nightly (506f22b46 2024-09-19)
    ✔ cargo: 1.83.0-nightly (a9a418d1a 2024-09-15)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: nightly-x86_64-pc-windows-msvc (default)
    - node: 22.8.0
    - npm: 10.8.3

[-] Packages
    - tauri 🦀: 2.0.0-rc.15
    - tauri-build 🦀: 2.0.0-rc.12
    - wry 🦀: 0.43.1
    - tao 🦀: 0.30.0
    - tauri-cli 🦀: 2.0.0-rc.7
    - @tauri-apps/api : 2.0.0-rc.4
    - @tauri-apps/cli : 2.0.0-rc.10

[-] Plugins
    - tauri-plugin-process 🦀: 2.0.0-rc.1
    - @tauri-apps/plugin-process : 2.0.0-rc.1
    - tauri-plugin-notification 🦀: 2.0.0-rc.5
    - @tauri-apps/plugin-notification : not installed!
    - tauri-plugin-shell 🦀: 2.0.0-rc.3
    - @tauri-apps/plugin-shell : 2.0.0-rc.1
    - tauri-plugin-log 🦀: 2.0.0-rc.2
    - @tauri-apps/plugin-log : 2.0.0-rc.1
    - tauri-plugin-store 🦀: 2.0.0-rc.3
    - @tauri-apps/plugin-store : 2.0.0-rc.1
    - tauri-plugin-updater 🦀: 2.0.0-rc.3
    - @tauri-apps/plugin-updater : 2.0.0-rc.1 (outdated, latest: 2.0.0-rc.2)
    - tauri-plugin-autostart 🦀: 2.0.0-rc.1
    - @tauri-apps/plugin-autostart : 2.0.0-rc.1
    - tauri-plugin-single-instance 🦀: 2.0.0-rc.4
    - @tauri-apps/plugin-single-instance : not installed!

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

Stack trace

[2024-09-26][06:20:48][tauri_runtime_wry][ERROR] failed to create webview: WebView2 error: WindowsError(Error { code: HRESULT(0x8007139F), message: "The group or resource is not in the correct state to perform the requested operation." })
[2024-09-26][06:20:57][tao::platform_impl::platform::event_loop::runner][WARN] NewEvents emitted without explicit RedrawEventsCleared
[2024-09-26][06:20:57][tao::platform_impl::platform::event_loop::runner][WARN] RedrawEventsCleared emitted without explicit MainEventsCleared
thread 'main' panicked at src\windows\popover.rs:81:48:
called `Result::unwrap()` on an `Err` value: Runtime(FailedToReceiveMessage)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at core\src\panicking.rs:221:5:
panic in a function that cannot unwind
stack backtrace:
   0:     0x7ff69fd066d1 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ff69fd066d1 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff69fd066d1 - std::sys::backtrace::_print_fmt
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\sys\backtrace.rs:66
   3:     0x7ff69fd066d1 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\sys\backtrace.rs:39
   4:     0x7ff69fd2cbd9 - core::fmt::rt::Argument::fmt
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/core\src\fmt\rt.rs:177
   5:     0x7ff69fd2cbd9 - core::fmt::write
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/core\src\fmt\mod.rs:1186
   6:     0x7ff69fd012a7 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\io\mod.rs:1823
   7:     0x7ff69fd06515 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\sys\backtrace.rs:42
   8:     0x7ff69fd086d9 - std::panicking::default_hook::closure$1
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\panicking.rs:268
   9:     0x7ff69fd0848f - std::panicking::default_hook
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\panicking.rs:295
  10:     0x7ff69fd08d63 - std::panicking::rust_panic_with_hook
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\panicking.rs:801
  11:     0x7ff69fd08bb2 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\panicking.rs:667
  12:     0x7ff69fd0718f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\sys\backtrace.rs:170
  13:     0x7ff69fd087ee - std::panicking::begin_panic_handler
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\panicking.rs:665
  14:     0x7ff69fd4c9d5 - core::panicking::panic_nounwind_fmt::runtime
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/core\src\panicking.rs:112
  15:     0x7ff69fd4c9d5 - core::panicking::panic_nounwind_fmt
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/core\src\panicking.rs:122
  16:     0x7ff69fd4ca83 - core::panicking::panic_nounwind
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/core\src\panicking.rs:221
  17:     0x7ff69fd4cc07 - core::panicking::panic_cannot_unwind
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/core\src\panicking.rs:310
  18:     0x7ff69f718e06 - webview2_com_sys::Microsoft::Web::WebView2::Win32::impl$991::new::Invoke<webview2_com::callback::WebResourceRequestedEventHandler_Impl,-1>
                               at D:\packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\webview2-com-sys-0.33.0\src\Microsoft.rs:39957
  19:     0x7ffc8468f540 - _CxxFrameHandler3
  20:     0x7ffc846833d8 - is_exception_typeof
  21:     0x7ffc94c94a26 - RtlCaptureContext2
  22:     0x7ff69f718dbb - webview2_com_sys::Microsoft::Web::WebView2::Win32::impl$991::new::Invoke<webview2_com::callback::WebResourceRequestedEventHandler_Impl,-1>
                               at D:\packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\webview2-com-sys-0.33.0\src\Microsoft.rs:39970
  23:     0x7ffc1a879e98 - DllGetClassObject
  24:     0x7ffc1a879cef - DllGetClassObject
  25:     0x7ffc1a89189d - DllGetClassObject
  26:     0x7ffc1a8e3d40 - DllCanUnloadNow
  27:     0x7ffc1a8cf970 - DllCanUnloadNow
  28:     0x7ffc1a8d27df - DllCanUnloadNow
  29:     0x7ffc1a8d427d - DllCanUnloadNow
  30:     0x7ffc1a8d41e7 - DllCanUnloadNow
  31:     0x7ffc1a8d40f2 - DllCanUnloadNow
  32:     0x7ffc1aac9391 - GetHandleVerifier
  33:     0x7ffc1aaf8333 - GetHandleVerifier
  34:     0x7ffc1a8d6083 - DllCanUnloadNow
  35:     0x7ffc1aad3e5e - GetHandleVerifier
  36:     0x7ffc1a94508c - DllCanUnloadNow
  37:     0x7ffc1aa82c3a - GetHandleVerifier
  38:     0x7ffc1aa83523 - GetHandleVerifier
  39:     0x7ffc1aa831e3 - GetHandleVerifier
  40:     0x7ffc1aa82de4 - GetHandleVerifier
  41:     0x7ffc1aa82c3a - GetHandleVerifier
  42:     0x7ffc1a9372f5 - DllCanUnloadNow
  43:     0x7ffc1a937770 - DllCanUnloadNow
  44:     0x7ffc1a99a9e9 - DllCanUnloadNow
  45:     0x7ffc1aa811c3 - GetHandleVerifier
  46:     0x7ffc1aa811c3 - GetHandleVerifier
  47:     0x7ffc1aa826ff - GetHandleVerifier
  48:     0x7ffc1aa788c4 - GetHandleVerifier
  49:     0x7ffc1a8c0eae - DllCanUnloadNow
  50:     0x7ffc1a8c0d16 - DllCanUnloadNow
  51:     0x7ffc1a8c057d - DllCanUnloadNow
  52:     0x7ffc1aae500c - GetHandleVerifier
  53:     0x7ffc1aae4efc - GetHandleVerifier
  54:     0x7ffc1aa0989f - DllCanUnloadNow
  55:     0x7ffc933082e1 - DispatchMessageW
  56:     0x7ffc93307da1 - DispatchMessageW
  57:     0x7ff69e7f633f - windows::Win32::UI::WindowsAndMessaging::DispatchMessageW
                               at D:\packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-0.58.0\src\Windows\Win32\UI\WindowsAndMessaging\mod.rs:772
  58:     0x7ff69e30945b - tao::platform_impl::platform::event_loop::EventLoop<enum2$<tauri_runtime_wry::Message<enum2$<tauri::EventLoopMessage> > > >::run_return<enum2$<tauri_runtime_wry::Message<enum2$<tauri::EventLoopMessage> > >,tauri_runtime_wry::impl$45::run::closure_env$0<enu
                               at D:\packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\tao-0.30.0\src\platform_impl\windows\event_loop.rs:259        
  59:     0x7ff69e309adb - tao::platform_impl::platform::event_loop::EventLoop<enum2$<tauri_runtime_wry::Message<enum2$<tauri::EventLoopMessage> > > >::run<enum2$<tauri_runtime_wry::Message<enum2$<tauri::EventLoopMessage> > >,tauri_runtime_wry::impl$45::run::closure_env$0<enum2$<tau
                               at D:\packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\tao-0.30.0\src\platform_impl\windows\event_loop.rs:221        
  60:     0x7ff69e473401 - tao::event_loop::EventLoop<enum2$<tauri_runtime_wry::Message<enum2$<tauri::EventLoopMessage> > > >::run<enum2$<tauri_runtime_wry::Message<enum2$<tauri::EventLoopMessage> > >,tauri_runtime_wry::impl$45::run::closure_env$0<enum2$<tauri::EventLoopMessage>,tau
                               at D:\packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\tao-0.30.0\src\event_loop.rs:211
  61:     0x7ff69e80a719 - tauri_runtime_wry::impl$45::run<enum2$<tauri::EventLoopMessage>,tauri::app::impl$16::run::closure_env$0<tauri_runtime_wry::Wry<enum2$<tauri::EventLoopMessage> >,void (*)(ref$<tauri::app::AppHandle<tauri_runtime_wry::Wry<enum2$<tauri::EventLoopMessage> > >
                               at D:\packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\tauri-runtime-wry-2.0.0-rc.13\src\lib.rs:2633
  62:     0x7ff69e37e140 - tauri::app::App<tauri_runtime_wry::Wry<enum2$<tauri::EventLoopMessage> > >::run<tauri_runtime_wry::Wry<enum2$<tauri::EventLoopMessage> >,void (*)(ref$<tauri::app::AppHandle<tauri_runtime_wry::Wry<enum2$<tauri::EventLoopMessage> > > >,enum2$<tauri::app::Run
                               at D:\packages\cargo\registry\src\index.crates.io-6f17d22bba15001f\tauri-2.0.0-rc.15\src\app.rs:1093
  63:     0x7ff69e647f9a - sebn_taskbar_client::core::app::run
                               at D:\mykyta.nehrych\code\sebn\sebn-taskbar-client-next\src-tauri\src\core\app.rs:136
  64:     0x7ff69e6b83ed - sebn_taskbar_client::main
                               at D:\mykyta.nehrych\code\sebn\sebn-taskbar-client-next\src-tauri\src\main.rs:17
  65:     0x7ff69e4bcb8b - core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library\core\src\ops\function.rs:250
  66:     0x7ff69e3f72de - core::hint::black_box
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library\core\src\hint.rs:389
  67:     0x7ff69e3f72de - std::sys::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library\std\src\sys\backtrace.rs:154
  68:     0x7ff69e123b51 - std::rt::lang_start::closure$0<tuple$<> >
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library\std\src\rt.rs:164
  69:     0x7ff69fcfad89 - std::rt::lang_start_internal::closure$2
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\rt.rs:143
  70:     0x7ff69fcfad89 - std::panicking::try::do_call
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\panicking.rs:557
  71:     0x7ff69fcfad89 - std::panicking::try
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\panicking.rs:520
  72:     0x7ff69fcfad89 - std::panic::catch_unwind
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\panic.rs:348
  73:     0x7ff69fcfad89 - std::rt::lang_start_internal
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library/std\src\rt.rs:143
  74:     0x7ff69e123b2a - std::rt::lang_start<tuple$<> >
                               at /rustc/506f22b4663f3e756e1e6a4f66c6309fdc00819c\library\std\src\rt.rs:163
  75:     0x7ff69e6b8459 - main
  76:     0x7ff69fd49cec - invoke_main
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  77:     0x7ff69fd49cec - __scrt_common_main_seh
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  78:     0x7ffc937c257d - BaseThreadInitThunk
  79:     0x7ffc94c4af28 - RtlUserThreadStart
thread caused non-unwinding panic. aborting.

Additional context

No response

@Elendiar Elendiar added status: needs triage This issue needs to triage, applied to new issues type: bug labels Sep 26, 2024
@FabianLars
Copy link
Member

FabianLars commented Sep 26, 2024

i get HRESULT(0x8007139F) on any webview create from javascript frontend (ts/react).
But other windows, created from rust frontend works.

That part doesn't make sense to me tbh. It's not documented properly but every different additional_browser_args config also need a different data_directory config (so as long as the browser args are the same, they can share a directory). If you don't do this you get the "not in the correct state" error.

@Elendiar
Copy link
Author

Elendiar commented Sep 26, 2024

i get HRESULT(0x8007139F) on any webview create from javascript frontend (ts/react).
But other windows, created from rust frontend works.

That part doesn't make sense to me tbh. It's not documented properly but every different additional_browser_args config also need a different data_directory config (so as long as the browser args are the same, they can share a directory). If you don't do this you get the "not in the correct state" error.

I mean that from frontend webview created without any arguments, there is no such property new WebviewWindow(label, {...}, but if any window with additional_browser_args builded in rust, i get this error.

That is, in order for this error not to occur, you must also specify data_directory when specifying additional_browser_args in rust builder?

@FabianLars
Copy link
Member

That is, in order for this error not to occur, you must also specify data_directory when specifying additional_browser_args in rust builder?

Yes

@FabianLars FabianLars added type: documentation Need to update the API documentation and removed status: needs triage This issue needs to triage, applied to new issues type: bug labels Sep 26, 2024
@FabianLars FabianLars changed the title [bug] additional_browser_args to window builder causes failed to create webview: WebView2 error document that changing additional_browser_args require changing data_directory if multiple webviews will be opened Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation Need to update the API documentation
Projects
None yet
Development

No branches or pull requests

2 participants