Skip to content

Commit 8fac1c5

Browse files
authored
Revert "Show specific error message for dotnet <app_path> where app_path is…" (#117937)
This reverts commit 9d6caae.
1 parent 2edd5fc commit 8fac1c5

File tree

3 files changed

+1
-47
lines changed

3 files changed

+1
-47
lines changed

src/installer/tests/HostActivation.Tests/DotnetArgValidation.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -68,41 +68,6 @@ public void MissingArgumentValue_Fails()
6868
.And.HaveStdErrContaining($"Failed to parse supported options or their values:");
6969
}
7070

71-
[Fact]
72-
public void File_ExistsNoDirectorySeparator_RoutesToSDK()
73-
{
74-
// Create a file named "build" in the current directory to simulate a file that happens to match the name of a command
75-
string buildFile = Path.Combine(sharedTestState.BaseDirectory.Location, "build");
76-
File.WriteAllText(buildFile, string.Empty);
77-
78-
// Test that "dotnet build" still routes to SDK, not to the file
79-
TestContext.BuiltDotNet.Exec("build")
80-
.WorkingDirectory(sharedTestState.BaseDirectory.Location)
81-
.EnableTracingAndCaptureOutputs()
82-
.Execute()
83-
.Should().Fail()
84-
.And.HaveStdErrContaining("The command could not be loaded, possibly because:") // This is a generic error for when we can't tell what exactly the user intended to do
85-
.And.HaveStdErrContaining("Resolving SDKs");
86-
}
87-
88-
[Fact]
89-
public void RelativePathToNonManagedFile_ShowsSpecificError()
90-
{
91-
// Test relative path with directory separator
92-
Directory.CreateDirectory(Path.Combine(sharedTestState.BaseDirectory.Location, "subdir"));
93-
string testFile = Path.Combine(sharedTestState.BaseDirectory.Location, "subdir", "test.json");
94-
File.WriteAllText(testFile, "{}");
95-
96-
string relativePath = Path.GetRelativePath(sharedTestState.BaseDirectory.Location, testFile);
97-
TestContext.BuiltDotNet.Exec(relativePath)
98-
.WorkingDirectory(sharedTestState.BaseDirectory.Location)
99-
.CaptureStdOut()
100-
.CaptureStdErr()
101-
.Execute()
102-
.Should().Fail()
103-
.And.HaveStdErrContaining($"The application '{relativePath}' is not a managed .dll.");
104-
}
105-
10671
[Fact]
10772
public void InvalidFileOrCommand_NoSDK_ListsPossibleIssues()
10873
{

src/installer/tests/HostActivation.Tests/FrameworkDependentAppLaunch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void Muxer_AssemblyWithDifferentFileExtension_Fails()
5858
.CaptureStdErr()
5959
.Execute()
6060
.Should().Fail()
61-
.And.HaveStdErrContaining($"The application '{appOtherExt}' is not a managed .dll.");
61+
.And.HaveStdErrContaining($"The application '{appOtherExt}' does not exist or is not a managed .dll or .exe");
6262
}
6363

6464
[Fact]

src/native/corehost/fxr/command_line.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,6 @@ namespace
164164
trace::verbose(_X("Application '%s' is not a managed executable."), app_candidate.c_str());
165165
if (!exec_mode)
166166
{
167-
// Check if this is a non-managed file with directory separator that exists
168-
// This should show a specific error instead of routing to CLI
169-
bool has_dir_separator = app_candidate.find(DIR_SEPARATOR) != pal::string_t::npos;
170-
if (has_dir_separator)
171-
{
172-
if (pal::file_exists(app_candidate))
173-
{
174-
trace::error(_X("The application '%s' is not a managed .dll."), app_candidate.c_str());
175-
return StatusCode::InvalidArgFailure;
176-
}
177-
}
178167
// Route to CLI.
179168
return StatusCode::AppArgNotRunnable;
180169
}

0 commit comments

Comments
 (0)