Skip to content

Commit 71de7f1

Browse files
authored
[ProcessLauncher] Explicitly set diagnostic port configs (#5503)
Partly addresses #5501 Child processes started by diagnostic tooling set a `DOTNET_DiagnosticPort` environment variable, specifying only the path. The runtime [defaults to a connect type port in suspend mode](https://github.com/dotnet/runtime/blob/22ccb0563cbb79e950b8d8e2d8bed306b125e7d8/src/native/eventpipe/ds-ipc.c#L628-L637), which isn't clear from the end user's viewpoint, as [logging will only reveal the DiagnosticPort value](https://github.com/dotnet/runtime/blob/22ccb0563cbb79e950b8d8e2d8bed306b125e7d8/src/coreclr/vm/eventing/eventpipe/ds-rt-coreclr.h#L390-L412). Instead, we can mitigate confusion by explicitly setting the config from the tooling side. ### Before ``` The runtime has been configured to pause during startup and is awaiting a Diagnostics IPC ResumeStartup command from a Diagnostic Port. DOTNET_DiagnosticPorts="dotnet-trace-48696-20250614_161420.socket" DOTNET_DefaultDiagnosticPortSuspend=0 ``` ### Now ``` The runtime has been configured to pause during startup and is awaiting a Diagnostics IPC ResumeStartup command from a Diagnostic Port. DOTNET_DiagnosticPorts="dotnet-trace-29004-20250616_134924.socket,suspend,connect" DOTNET_DefaultDiagnosticPortSuspend=0 ```
1 parent f391d8d commit 71de7f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Tools/Common/ReversedServerHelpers/ReversedServerHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public bool Start(string diagnosticTransportName, CancellationToken ct, bool sho
9595
_childProc.StartInfo.RedirectStandardOutput = !showChildIO;
9696
_childProc.StartInfo.RedirectStandardError = !showChildIO;
9797
_childProc.StartInfo.RedirectStandardInput = !showChildIO;
98-
_childProc.StartInfo.Environment.Add("DOTNET_DiagnosticPorts", $"{diagnosticTransportName}");
98+
_childProc.StartInfo.Environment.Add("DOTNET_DiagnosticPorts", $"{diagnosticTransportName},suspend,connect");
9999
try
100100
{
101101
if (printLaunchCommand && !showChildIO)

0 commit comments

Comments
 (0)