Describe the bug
Selecting text within the Tauri window and dragging the selection in any direction immediately results in a crash when Tauri is initialized from #[tokio::main]. This crash does not occur when running in a non-async fn main.
To Reproduce
Steps to reproduce the behavior:
yarn create tauri-app
- Add
tokio = { version = "1.13.0", features = ["full"] } to dependencies in Cargo.toml
- In
src-tauri/src/main.rs, replace main function with:
#[tokio::main]
async fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
- Start Tauri, select text and try dragging
Expected behavior
Drag and drop functions normally; the window does not crash.
Platform and Versions (required):
Operating System - Windows, version 10.0.19043 X64
Webview2 - 95.0.1020.40
Node.js environment
Node.js - 16.13.0
@tauri-apps/cli - 1.0.0-beta.10
@tauri-apps/api - 1.0.0-beta.8
Global packages
npm - 8.1.2
yarn - 1.22.15
Rust environment
rustc - 1.56.1
cargo - 1.56.0
App directory structure
/dist
/node_modules
/src
/src-tauri
App
tauri.rs - 1.0.0-beta.8
build-type - bundle
CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
distDir - ../dist
devPath - http://localhost:8181
Tested on both Windows and Manjaro Linux; results in a crash regardless of OS.
Additional context
#[tokio::main] is added so that some asynchronous tasks can be performed in the main function prior to initializing Tauri (e.g. reading/writing to config files, which stores results in Tauri state).
Stack Trace
Running `target\debug\app.exe`
thread 'main' panicked at 'Cannot start a runtime from within a runtimk the current thread while the thread is being used to drive asynchronous tasks.', C:\Users\Daniel\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.13.0\src\runtime\enter.rs:39:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: Rust panics must be rethrown
error: process didn't exit successfully: `target\debug\app.exe` (exit
code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)
Describe the bug
Selecting text within the Tauri window and dragging the selection in any direction immediately results in a crash when Tauri is initialized from
#[tokio::main]. This crash does not occur when running in a non-asyncfn main.To Reproduce
Steps to reproduce the behavior:
yarn create tauri-apptokio = { version = "1.13.0", features = ["full"] }to dependencies inCargo.tomlsrc-tauri/src/main.rs, replace main function with:Expected behavior
Drag and drop functions normally; the window does not crash.
Platform and Versions (required):
Tested on both Windows and Manjaro Linux; results in a crash regardless of OS.
Additional context
#[tokio::main]is added so that some asynchronous tasks can be performed in the main function prior to initializing Tauri (e.g. reading/writing to config files, which stores results in Tauri state).Stack Trace