Phase 4: Replace Console output with Debug.WriteLine in diagnostic code

- Replaced Console.WriteLine with System.Diagnostics.Debug.WriteLine in:
  * LaunchOrderDetector (probe scoring)
  * UnpackagedDetector (probe scoring)
  * ElectronProcessActive (StartInternal traces)
- Removed '[StartInternal]: after run:' trace
- Debug.WriteLine only outputs when debugger is attached

These were the noisiest debugging traces. Other Console.WriteLine usage
in StartupManager, ProcessRunner, etc. would require ILogger injection
which is a larger architectural change deferred for now.
This commit is contained in:
Pierre Arnaud
2026-01-31 11:19:28 +01:00
parent 805d942b11
commit 03da5cd7cb
3 changed files with 11 additions and 11 deletions

View File

@@ -32,7 +32,8 @@
}
}
Console.WriteLine("Probe scored for launch origin: DotNet {0} vs. {1} Electron", scoreDotNet, scoreElectron);
// Debug trace - useful for diagnostics
System.Diagnostics.Debug.WriteLine($"Probe scored for launch origin: DotNet {scoreDotNet} vs. {scoreElectron} Electron");
return scoreDotNet > scoreElectron;
}

View File

@@ -38,7 +38,8 @@
}
}
Console.WriteLine("Probe scored for package mode: Unpackaged {0} vs. {1} Packaged", scoreUnpackaged, scorePackaged);
// Debug trace - useful for diagnostics
System.Diagnostics.Debug.WriteLine($"Probe scored for package mode: Unpackaged {scoreUnpackaged} vs. {scorePackaged} Packaged");
return scoreUnpackaged > scorePackaged;
}

View File

@@ -161,8 +161,8 @@
{
await Task.Delay(10.ms()).ConfigureAwait(false);
Console.Error.WriteLine("[StartInternal]: startCmd: {0}", startCmd);
Console.Error.WriteLine("[StartInternal]: args: {0}", args);
System.Diagnostics.Debug.WriteLine($"[StartInternal]: startCmd: {startCmd}");
System.Diagnostics.Debug.WriteLine($"[StartInternal]: args: {args}");
this.process = new ProcessRunner("ElectronRunner");
this.process.ProcessExited += this.Process_Exited;
@@ -170,12 +170,10 @@
await Task.Delay(500.ms()).ConfigureAwait(false);
Console.Error.WriteLine("[StartInternal]: after run:");
if (!this.process.IsRunning)
{
Console.Error.WriteLine("[StartInternal]: Process is not running: " + this.process.StandardError);
Console.Error.WriteLine("[StartInternal]: Process is not running: " + this.process.StandardOutput);
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Process is not running: {this.process.StandardError}");
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Process is not running: {this.process.StandardOutput}");
Task.Run(() => this.TransitionState(LifetimeState.Stopped));
@@ -186,9 +184,9 @@
}
catch (Exception ex)
{
Console.Error.WriteLine("[StartInternal]: Exception: " + this.process?.StandardError);
Console.Error.WriteLine("[StartInternal]: Exception: " + this.process?.StandardOutput);
Console.Error.WriteLine("[StartInternal]: Exception: " + ex);
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Exception: {this.process?.StandardError}");
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Exception: {this.process?.StandardOutput}");
System.Diagnostics.Debug.WriteLine($"[StartInternal]: Exception: {ex}");
throw;
}
}