Skip to content

[bug] [macOS] NSOpenPanel openPanel returns NULL #13047

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

Open
dwosk opened this issue Mar 21, 2025 · 3 comments
Open

[bug] [macOS] NSOpenPanel openPanel returns NULL #13047

dwosk opened this issue Mar 21, 2025 · 3 comments
Labels
platform: macOS status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@dwosk
Copy link

dwosk commented Mar 21, 2025

Describe the bug

On startup, my application will check for updates and automatically download and install them in the background. Once complete, the app will display a "Restart app" indicator to the user so that they can restart the app when they are ready to apply the update.

However, it seems like after an update is installed, opening a file dialog will result in a panic. For example, via the open export of @tauri-apps/plugin-dialog.

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.4.1 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: 1.81.0-aarch64-apple-darwin (overridden by '/Users/dwosk/development/projects/desktop-app/dev/rust-toolchain.toml')
    - node: 22.2.0
    - npm: 10.7.0

[-] Packages
    - tauri 🦀: 2.3.1
    - tauri-build 🦀: 2.0.6
    - wry 🦀: 0.50.1
    - tao 🦀: 0.32.8
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli : 2.3.1 (outdated, latest: 2.4.0)

[-] Plugins
    - tauri-plugin-updater 🦀: 2.5.1
    - @tauri-apps/plugin-updater : not installed!
    - tauri-plugin-fs 🦀: 2.2.0
    - @tauri-apps/plugin-fs : not installed!
    - tauri-plugin-os 🦀: 2.2.0
    - @tauri-apps/plugin-os : not installed!
    - tauri-plugin-deep-link 🦀: 2.2.0
    - @tauri-apps/plugin-deep-link : not installed!
    - tauri-plugin-single-instance 🦀: 2.2.2
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-dialog 🦀: 2.2.0
    - @tauri-apps/plugin-dialog : not installed!
    - tauri-plugin-notification 🦀: 2.2.1
    - @tauri-apps/plugin-notification : not installed!
    - tauri-plugin-process 🦀: 2.2.0
    - @tauri-apps/plugin-process : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../../frontend/build
    - devUrl: http://localhost:3000/

Stack trace

2025-03-21 14:10:50.211 aspera-desktop[84277:17278983] +[NSXPCSharedListener endpointForReply:withListenerName:replyErrorCode:]: an error occurred while attempting to obtain endpoint for listener 'com.apple.view-bridge': Connection interrupted
2025-03-21T21:10:50.212220Z ERROR desktop_app: Uncaught panic location="/Users/dwosk/.cargo/registry/src/.../objc2-app-kit-0.2.2/src/generated/NSOpenPanel.rs:110:1" app_version="1.0.7 (0)" app_commit_sha="d42cd84c9804" release_channel="dev" os_name="macOS" os_version="14.4.1" architecture="aarch64" timestamp=1742591450212
thread 'main' panicked at /Users/dwosk/.cargo/registry/src/.../objc2-app-kit-0.2.2/src/generated/NSOpenPanel.rs:110:1:
unexpected NULL returned from +[NSOpenPanel openPanel]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2025-03-21T21:10:50.212960Z ERROR desktop_app: Uncaught panic location="/Users/dwosk/.cargo/registry/src/.../tauri-plugin-dialog-2.2.0/src/lib.rs:616:9" app_version="1.0.7 (0)" app_commit_sha="d42cd84c9804" release_channel="dev" os_name="macOS" os_version="14.4.1" architecture="aarch64" timestamp=1742591450212
thread 'tokio-runtime-worker' panicked at /Users/dwosk/.cargo/registry/src/.../tauri-plugin-dialog-2.2.0/src/lib.rs:616:9:
called `Result::unwrap()` on an `Err` value: RecvError

Additional context

No response

@dwosk dwosk added status: needs triage This issue needs to triage, applied to new issues type: bug labels Mar 21, 2025
@dwosk
Copy link
Author

dwosk commented Mar 21, 2025

Found this error in Console.app:

Unable to display open panel (unrecognized error: Error Domain=NSXPCSharedListenerErrorDomain Code=2 "<dictionary: 0x1ff2461a0> { count = 1, transaction: 0, voucher = 0x0, contents =
	"XPCErrorDescription" => <string: 0x1ff246390> { length = 22, contents = "Connection interrupted" }
} for listener 'com.apple.view-bridge'; BEFORE ASSIGNING A BUG TO ANYONE ELSE, search backward for earlier logging regarding service/extension 'com.apple.appkit.xpc.openAndSavePanelService'" UserInfo={NSDebugDescription=<dictionary: 0x1ff2461a0> { count = 1, transaction: 0, voucher = 0x0, contents =
	"XPCErrorDescription" => <string: 0x1ff246390> { length = 22, contents = "Connection interrupted" }
} for listener 'com.apple.view-bridge'; BEFORE ASSIGNING A BUG TO ANYONE ELSE, search backward for earlier logging regarding service/extension 'com.apple.appkit.xpc.openAndSavePanelService'})

@dwosk
Copy link
Author

dwosk commented Mar 21, 2025

Based off that message, here are the previous logs from that specific xpc service. Just a screenshot as not sure how to export as text:

Image

I'm guessing Apple invalidates the xpc connection for security reasons?

@dwosk
Copy link
Author

dwosk commented Mar 22, 2025

So far having good results by adding a couple of entitlements:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.security.cs.allow-jit</key>
	<true/>
	<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
	<true/>
</dict>
</plist>

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

No branches or pull requests

2 participants