Skip to content
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

dotnet.exe prints error messages to console when launched with empty DOTNET_MULTILEVEL_LOOKUP #84322

Merged
merged 10 commits into from
Apr 11, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ public void AppHost_FrameworkDependent_GlobalLocation_Succeeds(bool useRegistere
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
.And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion);
.And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion)
.And.NotHaveStdErr();

// Verify running from within the working directory
Command.Create(appExe)
Expand All @@ -216,7 +217,8 @@ public void AppHost_FrameworkDependent_GlobalLocation_Succeeds(bool useRegistere
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World")
.And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion);
.And.HaveStdOutContaining(sharedTestState.RepoDirectories.MicrosoftNETCoreAppVersion)
.And.NotHaveStdErr();
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/installer/tests/HostActivation.Tests/StartupHooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ public void Muxer_activation_of_Empty_StartupHook_Variable_Succeeds()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World");
.And.HaveStdOutContaining("Hello World")
.And.NotHaveStdErr();
}

// Run the app with a startup hook assembly that depends on assemblies not on the TPA list
Expand Down
8 changes: 6 additions & 2 deletions src/native/corehost/hostmisc/pal.windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,14 +570,18 @@ bool pal::getenv(const char_t* name, string_t* recv)
auto err = GetLastError();
if (err != ERROR_ENVVAR_NOT_FOUND)
{
trace::error(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(GetLastError()));
trace::warning(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(err));
}
return false;
}
auto buf = new char_t[length];
if (::GetEnvironmentVariableW(name, buf, length) == 0)
{
trace::error(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(GetLastError()));
auto err = GetLastError();
if (err != ERROR_ENVVAR_NOT_FOUND)
{
trace::warning(_X("Failed to read environment variable [%s], HRESULT: 0x%X"), name, HRESULT_FROM_WIN32(err));
}
return false;
}

Expand Down