-
-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Summary
Debug builds (npm run server and other debug commands) fail when using Rust versions newer than 1.85.1 on Windows. The application crashes with a null pointer dereference in the tauri_plugin_single_instance package during initialization. We've temporarily locked our Rust version to 1.85.1 as a workaround.
Environment
- Platform: Windows (only)
- Build Mode: Debug only (release builds work fine)
- Rust Versions Affected: Versions newer than 1.85.1
- Commands Affected:
npm run serverand any other commands that build in debug mode
Error Details
The application crashes with a null pointer dereference during initialization of the tauri_plugin_single_instance plugin. The error occurs in the Windows-specific implementation when creating the event target window.
Backtrace Highlights
panicking.rs:304 core::panicking::panic_null_pointer_dereference
windows.rs:109 tauri_plugin_single_instance::platform_impl::single_instance_window_proc<tauri_runtime_wry::Wry<enum2$<tauri::EventLoopMessage> > >
...
windows.rs:151 tauri_plugin_single_instance::platform_impl::create_event_target_window<tauri_runtime_wry::Wry<enum2$<tauri::EventLoopMessage> > >
windows.rs:67 tauri_plugin_single_instance::platform_impl::init::closure$0<tauri_runtime_wry::Wry<enum2$<tauri::EventLoopMessage> > >
Research & Analysis
- The issue is specific to Windows and only occurs in debug builds (with debug assertions enabled)
- The problem is in the Windows-specific implementation of
tauri_plugin_single_instance - It seems to be related to how the plugin initializes and creates Windows API-based event windows
- The null pointer dereference suggests a value that was previously valid in Rust 1.85.1 is now null in newer versions
- Release builds work normally, suggesting this is related to debug-specific memory layout or assertions
Current Workaround
We've temporarily locked the Rust version to 1.85.1 in both our local development environment and CI pipeline:
Local Environment:
rustup default 1.85.1
GitHub Actions:
- name: install specific Rust version
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.85.1Potential Solutions
When we want to upgrade Rust in the future, we should consider these options:
-
Check for updates to
tauri-plugin-single-instancethat might fix compatibility with newer Rust versions -
Conditionally disable the plugin in debug mode on Windows:
#[cfg(not(all(debug_assertions, target_os = "windows")))] { // Only initialize single-instance plugin in release mode or non-Windows platforms app = app.plugin(tauri_plugin_single_instance::init(|app, argv, cwd| { // Single-instance handling })); }
-
Fork and fix the plugin - The issue is likely in the Windows-specific module of the plugin
-
Contact the plugin maintainers - File an issue in the plugin repository with our findings
Next Steps
- Create an issue in the
tauri-plugin-single-instancerepository - Investigate if we can conditionally disable the plugin for Windows debug builds
- Revisit this issue when attempting to upgrade Rust in the future
References
- [Rust Release Notes](https://github.com/rust-lang/rust/blob/master/RELEASES.md) - Check for relevant changes in newer Rust versions
- [tauri-plugin-single-instance Repository](https://github.com/tauri-apps/plugins-workspace/tree/v1/plugins/single-instance)