Skip to content

Commit aa89d21

Browse files
authored
Fix clearing and reading env variables in startup hook (#50821)
1 parent f89f133 commit aa89d21

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/BuiltInTools/DotNetDeltaApplier/StartupHook.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static void Initialize()
3232

3333
HotReloadAgent.ClearHotReloadEnvironmentVariables(typeof(StartupHook));
3434

35-
if (s_namedPipeName == null)
35+
if (string.IsNullOrEmpty(s_namedPipeName))
3636
{
3737
Log($"Environment variable {AgentEnvironmentVariables.DotNetWatchHotReloadNamedPipeName} has no value");
3838
return;
@@ -86,7 +86,7 @@ private static void RegisterSignalHandlers()
8686
private static void Log(string message)
8787
{
8888
var prefix = s_standardOutputLogPrefix;
89-
if (prefix != null)
89+
if (!string.IsNullOrEmpty(prefix))
9090
{
9191
Console.ForegroundColor = ConsoleColor.DarkGray;
9292
Console.WriteLine($"{prefix} {message}");

src/BuiltInTools/HotReloadAgent/HotReloadAgent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ public static void ClearHotReloadEnvironmentVariables(Type startupHookType)
237237
Environment.SetEnvironmentVariable(AgentEnvironmentVariables.DotNetStartupHooks,
238238
RemoveCurrentAssembly(startupHookType, Environment.GetEnvironmentVariable(AgentEnvironmentVariables.DotNetStartupHooks)!));
239239

240-
Environment.SetEnvironmentVariable(AgentEnvironmentVariables.DotNetWatchHotReloadNamedPipeName, "");
241-
Environment.SetEnvironmentVariable(AgentEnvironmentVariables.HotReloadDeltaClientLogMessages, "");
240+
Environment.SetEnvironmentVariable(AgentEnvironmentVariables.DotNetWatchHotReloadNamedPipeName, null);
241+
Environment.SetEnvironmentVariable(AgentEnvironmentVariables.HotReloadDeltaClientLogMessages, null);
242242
}
243243

244244
// internal for testing

0 commit comments

Comments
 (0)