Failed to run .net application with related path
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 85
Description
Describe the bug
When running .net executable from nushell, it won't start if the command line is related file path, such as:
.\ILSpy_binaries_7.2.1.6856\ILSpy.exe
From fuslogvw, I can see something wrong in the log:
*** Assembly Binder Log Entry (2023/7/12 @ 13:30:27) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable \\?\F:\Software\ILSpy_binaries_7.2.1.6856\ILSpy.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file://?/F:/Software/ILSpy_binaries_7.2.1.6856/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ILSpy.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Found assembly by looking in the GAC.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll.
LOG: Assembly is loaded in default load context.
Firstly the command line now starts with " \?".
Secondly, it reports "LOG: No application configuration file found.", which the ILSpy.exe.config exists and placed in the same directory of ILSpy.exe.
I try other .net application, it has the same problem.
But if I use the absolute file path, it runs fine!
And the previous strange log are gone (No more starts with "\?" and report "No application configuration file found."
How to reproduce
Prepare any .net executable, such as ILSpy.exe (download from https://github.com/icsharpcode/ILSpy/releases)
run the executable with related path, such as .\ILSpy.exe
Expected behavior
The application runs fine.
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.82.0 |
| branch | |
| commit_hash | ecdb023e2f6cb17445ae799206e464b2daef3d71 |
| build_os | windows-x86_64 |
| build_target | x86_64-pc-windows-msvc |
| rust_version | rustc 1.68.2 (9eb3afe9e 2023-03-27) |
| rust_channel | 1.68.2-x86_64-pc-windows-msvc |
| cargo_version | cargo 1.68.2 (6feb7c9cf 2023-03-26) |
| build_time | 2023-06-27 17:32:54 +00:00 |
| build_rust_channel | release |
| allocator | standard |
| features | default, sqlite, trash, which, zip |
| installed_plugins | gstat |
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue on Windows with a .NET executable invoked as .\ILSpy.exe, then compare it with the equivalent absolute path. Trace Nushell's command-path handling and verify that relative invocation preserves the executable directory and configuration lookup so the application starts normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100