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

[bug] [beta.2] [windows] Flakey error when creating new windows with tauri commands #8891

Closed
huangmingg opened this issue Feb 18, 2024 · 1 comment
Labels
platform: Windows status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@huangmingg
Copy link

huangmingg commented Feb 18, 2024

Describe the bug

This is probably related to #8196, but a slightly different variant.

Unlike that issue however, I don't face any issue when creating windows on setup, or from tauri.conf.json. Instead, I get this 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." })

when invoking a tauri command that creates a new webview window, after the main window is loaded. To provide more context, this is a flakey behavior, and would actually work sometimes (if it fails for the first call, will have to re-run the dev command, or re-open the built app. if it works for the first call, the subsequent calls always seem to be successful as well).

I have followed the suggestions on the related issue, and am on the latest webview2 version (121.0.2277.128). I have also tried to create all windows manually, including the main window (so nothing defined in tauri.conf.json, but that does not work as well.

Reproduction

Adding the following command to commands example of tauri

#[command]
async fn open_new_window(
handle: tauri::AppHandle,
) {
let _docs_window = tauri::WebviewWindowBuilder::new(
&handle,
"newWindow",
tauri::WebviewUrl::App("index.html".into()),
)
.center()
.title("New Window")
.resizable(false)
.build()
.unwrap();
}

Expected behavior

It works sometimes, and fails with the following error on others
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." })

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 121.0.2277.128
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.74.1 (a28077b28 2023-12-04)
    ✔ cargo: 1.74.1 (ecb9851af 2023-10-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 16.16.0
    - pnpm: 6.11.0
    - yarn: 1.22.15
    - npm: 8.11.0


[-] Packages
    - tauri [RUST]: 2.0.0-beta.2
    - tauri-build [RUST]: 2.0.0-beta.1
    - wry [RUST]: 0.36.0
    - tao [RUST]: 0.25.0
    - @tauri-apps/api [NPM]: 2.0.0-beta.0
    - @tauri-apps/cli [NPM]: 2.0.0-beta.1

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

Stack trace

No response

Additional context

No response

@huangmingg huangmingg added status: needs triage This issue needs to triage, applied to new issues type: bug labels Feb 18, 2024
@amrbashir
Copy link
Member

fixed by tauri-apps/wry#1182

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Windows status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

3 participants