-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Show specific error message for dotnet <app_path>
where app_path is a non-dll/exe file that exists
#116940
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
base: main
Are you sure you want to change the base?
Conversation
… separators Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
dotnet <app_path>
where <app_path> is a non-dll/exe file that existsdotnet <app_path>
where app_path is a non-dll/exe file that exists
src/native/corehost/fxr/fx_muxer.cpp
Outdated
@@ -572,6 +572,11 @@ int fx_muxer_t::execute( | |||
return result; | |||
} | |||
} | |||
else if (static_cast<StatusCode>(result) == AppArgNotManagedFailure) | |||
{ | |||
trace::error(_X("The application '%s' does not exist or is not a managed .dll or .exe."), app_candidate.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trace::error(_X("The application '%s' does not exist or is not a managed .dll or .exe."), app_candidate.c_str()); | |
trace::error(_X("The application '%s' is not a managed .dll or .exe."), app_candidate.c_str()); |
This error code is returned above only when the file actually exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the error message to remove "does not exist or" since this error code is only returned when the file actually exists. Changes committed in d2dd638.
…reporting Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
…error directly in command_line.cpp Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
…tions, remove test file Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
…k lines, simplify test tracing calls Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
string testFile = Path.Combine(sharedTestState.BaseDirectory.Location, "subdir", "test.json"); | ||
File.WriteAllText(testFile, "{}"); | ||
|
||
string relativePath = "./subdir/test.json"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string relativePath = "./subdir/test.json"; | |
string relativePath = Path.GetRelativePath(sharedTestState.BaseDirectory.Location, testFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to use Path.GetRelativePath(sharedTestState.BaseDirectory.Location, testFile)
for dynamic path computation. This makes the test more robust and maintainable. Changes committed in df74861.
Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>
Currently, when a user runs
dotnet <app_path>
and the host determines that<app_path>
is not a runnable app, it's treated as a CLI command and routed to the SDK, which shows a generic error message.This PR improves the user experience by detecting when the user passes a path to an existing non-dll/exe file and showing a specific error message instead of routing to the SDK.
Changes Made
Core Logic Enhancement:
AppArgNotManagedFailure
(0x80008090) using an unused error code slotcommand_line.cpp
to detect the specific scenario:fx_muxer.cpp
with clear error messageBehavior Change:
Before:
After:
$ dotnet /path/to/config.json The application '/path/to/config.json' does not exist or is not a managed .dll or .exe.
Preserves Existing Behavior:
dotnet build
) still route to SDKdotnet exec
behavior unchangedTest Coverage
Added comprehensive tests covering:
./subdir/file.txt
All existing tests pass, confirming no regressions.
Fixes #116939.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.