From 076a5936fd488a84bda14acdcc90eaf9bea0390f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Jul 2025 19:09:56 +0000 Subject: [PATCH 1/6] Initial plan From 05d119ca197ebb0ae390fa90220dbcaca630f970 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Jul 2025 19:21:35 +0000 Subject: [PATCH 2/6] Add DOTNET_HOST_TRACE environment variables documentation for .NET 10 Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- .../dependency-loading/default-probing.md | 13 +++++++----- .../tools/dotnet-environment-variables.md | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/core/dependency-loading/default-probing.md b/docs/core/dependency-loading/default-probing.md index 16617e163cee6..53b5d6853bd42 100644 --- a/docs/core/dependency-loading/default-probing.md +++ b/docs/core/dependency-loading/default-probing.md @@ -44,11 +44,14 @@ Each property is available by calling the ` |Traces to a file path instead of the default `stderr`.| -|`COREHOST_TRACE_VERBOSITY` |Sets the verbosity from 1 (lowest) to 4 (highest).| +|Environment Variable |Description | +|-------------------------------|---------| +|`DOTNET_HOST_TRACE=1` |Enables tracing. (.NET 10+)| +|`DOTNET_HOST_TRACEFILE=` |Traces to a file path instead of the default `stderr`. (.NET 10+)| +|`DOTNET_HOST_TRACE_VERBOSITY` |Sets the verbosity from 1 (lowest) to 4 (highest). (.NET 10+)| +|`COREHOST_TRACE=1` |Enables tracing.| +|`COREHOST_TRACEFILE=` |Traces to a file path instead of the default `stderr`.| +|`COREHOST_TRACE_VERBOSITY` |Sets the verbosity from 1 (lowest) to 4 (highest).| ## Managed assembly default probing diff --git a/docs/core/tools/dotnet-environment-variables.md b/docs/core/tools/dotnet-environment-variables.md index 2cbceee157c00..c4668cf93b0ee 100644 --- a/docs/core/tools/dotnet-environment-variables.md +++ b/docs/core/tools/dotnet-environment-variables.md @@ -395,10 +395,30 @@ Specifies the minimum number of hours between background downloads of advertisin Specifies whether .NET SDK local tools search for tool manifest files in the root folder on Windows. The default is `false`. +### `DOTNET_HOST_TRACE` + +**This variable applies to .NET 10 and later versions.** + +Controls diagnostics tracing from the hosting components, such as `dotnet.exe`, `hostfxr`, and `hostpolicy`. + +- `DOTNET_HOST_TRACE=[0/1]` - default is `0` - tracing disabled. If set to `1`, diagnostics tracing is enabled. +- `DOTNET_HOST_TRACEFILE=` - has an effect only if tracing is enabled by setting `DOTNET_HOST_TRACE=1`. When set, the tracing information is written to the specified file; otherwise, the trace information is written to `stderr`. +- `DOTNET_HOST_TRACE_VERBOSITY=[1/2/3/4]` - default is `4`. The setting is used only when tracing is enabled via `DOTNET_HOST_TRACE=1`. + + - `4` - all tracing information is written + - `3` - only informational, warning, and error messages are written + - `2` - only warning and error messages are written + - `1` - only error messages are written + +The typical way to get detailed trace information about application startup is to set `DOTNET_HOST_TRACE=1` and `DOTNET_HOST_TRACEFILE=host_trace.txt` and then run the application. A new file `host_trace.txt` will be created in the current directory with the detailed information. + ### `COREHOST_TRACE` Controls diagnostics tracing from the hosting components, such as `dotnet.exe`, `hostfxr`, and `hostpolicy`. +> [!NOTE] +> Starting with .NET 10, use the [`DOTNET_HOST_TRACE`](#dotnet_host_trace) environment variables instead. The `COREHOST_TRACE` variables work the same as `DOTNET_HOST_TRACE` variables. + - `COREHOST_TRACE=[0/1]` - default is `0` - tracing disabled. If set to `1`, diagnostics tracing is enabled. - `COREHOST_TRACEFILE=` - has an effect only if tracing is enabled by setting `COREHOST_TRACE=1`. When set, the tracing information is written to the specified file; otherwise, the trace information is written to `stderr`. - `COREHOST_TRACE_VERBOSITY=[1/2/3/4]` - default is `4`. The setting is used only when tracing is enabled via `COREHOST_TRACE=1`. From cffb090e460f04d19652a1e0eb5f0954ca35bf05 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Jul 2025 20:08:13 +0000 Subject: [PATCH 3/6] Address reviewer feedback: improve DOTNET_HOST_TRACE docs and reduce COREHOST_TRACE duplication Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- docs/core/tools/dotnet-environment-variables.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/core/tools/dotnet-environment-variables.md b/docs/core/tools/dotnet-environment-variables.md index c4668cf93b0ee..7467bb99cafcb 100644 --- a/docs/core/tools/dotnet-environment-variables.md +++ b/docs/core/tools/dotnet-environment-variables.md @@ -397,7 +397,7 @@ Specifies whether .NET SDK local tools search for tool manifest files in the roo ### `DOTNET_HOST_TRACE` -**This variable applies to .NET 10 and later versions.** +**This variable applies to .NET 10 and later versions.** For older versions, replace the `DOTNET_HOST_` prefix with `COREHOST_`. See [`COREHOST_TRACE`](#corehost_trace). Controls diagnostics tracing from the hosting components, such as `dotnet.exe`, `hostfxr`, and `hostpolicy`. @@ -421,12 +421,7 @@ Controls diagnostics tracing from the hosting components, such as `dotnet.exe`, - `COREHOST_TRACE=[0/1]` - default is `0` - tracing disabled. If set to `1`, diagnostics tracing is enabled. - `COREHOST_TRACEFILE=` - has an effect only if tracing is enabled by setting `COREHOST_TRACE=1`. When set, the tracing information is written to the specified file; otherwise, the trace information is written to `stderr`. -- `COREHOST_TRACE_VERBOSITY=[1/2/3/4]` - default is `4`. The setting is used only when tracing is enabled via `COREHOST_TRACE=1`. - - - `4` - all tracing information is written - - `3` - only informational, warning, and error messages are written - - `2` - only warning and error messages are written - - `1` - only error messages are written +- `COREHOST_TRACE_VERBOSITY=[1/2/3/4]` - default is `4`. The setting is used only when tracing is enabled via `COREHOST_TRACE=1`. For verbosity level meanings, see [`DOTNET_HOST_TRACE_VERBOSITY`](#dotnet_host_trace). The typical way to get detailed trace information about application startup is to set `COREHOST_TRACE=1` and`COREHOST_TRACEFILE=host_trace.txt` and then run the application. A new file `host_trace.txt` will be created in the current directory with the detailed information. From 9fed0bd0e61207e270b520f2d27e6c5d03dc32d4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Jul 2025 20:20:39 +0000 Subject: [PATCH 4/6] Simplify COREHOST_TRACE docs and improve dependency loading table format Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com> --- docs/core/dependency-loading/default-probing.md | 11 +++++------ docs/core/tools/dotnet-environment-variables.md | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/core/dependency-loading/default-probing.md b/docs/core/dependency-loading/default-probing.md index 53b5d6853bd42..a07ca38ed5bcd 100644 --- a/docs/core/dependency-loading/default-probing.md +++ b/docs/core/dependency-loading/default-probing.md @@ -46,12 +46,11 @@ The .NET Core runtime host will output useful trace messages when certain enviro |Environment Variable |Description | |-------------------------------|---------| -|`DOTNET_HOST_TRACE=1` |Enables tracing. (.NET 10+)| -|`DOTNET_HOST_TRACEFILE=` |Traces to a file path instead of the default `stderr`. (.NET 10+)| -|`DOTNET_HOST_TRACE_VERBOSITY` |Sets the verbosity from 1 (lowest) to 4 (highest). (.NET 10+)| -|`COREHOST_TRACE=1` |Enables tracing.| -|`COREHOST_TRACEFILE=` |Traces to a file path instead of the default `stderr`.| -|`COREHOST_TRACE_VERBOSITY` |Sets the verbosity from 1 (lowest) to 4 (highest).| +|`DOTNET_HOST_TRACE=1` |Enables tracing.| +|`DOTNET_HOST_TRACEFILE=` |Traces to a file path instead of the default `stderr`.| +|`DOTNET_HOST_TRACE_VERBOSITY` |Sets the verbosity from 1 (lowest) to 4 (highest).| + +See [DOTNET_HOST_TRACE environment variables](../tools/dotnet-environment-variables.md#dotnet_host_trace) for details. ## Managed assembly default probing diff --git a/docs/core/tools/dotnet-environment-variables.md b/docs/core/tools/dotnet-environment-variables.md index 7467bb99cafcb..d3982ce15416b 100644 --- a/docs/core/tools/dotnet-environment-variables.md +++ b/docs/core/tools/dotnet-environment-variables.md @@ -419,9 +419,9 @@ Controls diagnostics tracing from the hosting components, such as `dotnet.exe`, > [!NOTE] > Starting with .NET 10, use the [`DOTNET_HOST_TRACE`](#dotnet_host_trace) environment variables instead. The `COREHOST_TRACE` variables work the same as `DOTNET_HOST_TRACE` variables. -- `COREHOST_TRACE=[0/1]` - default is `0` - tracing disabled. If set to `1`, diagnostics tracing is enabled. -- `COREHOST_TRACEFILE=` - has an effect only if tracing is enabled by setting `COREHOST_TRACE=1`. When set, the tracing information is written to the specified file; otherwise, the trace information is written to `stderr`. -- `COREHOST_TRACE_VERBOSITY=[1/2/3/4]` - default is `4`. The setting is used only when tracing is enabled via `COREHOST_TRACE=1`. For verbosity level meanings, see [`DOTNET_HOST_TRACE_VERBOSITY`](#dotnet_host_trace). +- `COREHOST_TRACE` - see [`DOTNET_HOST_TRACE`](#dotnet_host_trace). +- `COREHOST_TRACEFILE` - see [`DOTNET_HOST_TRACEFILE`](#dotnet_host_trace). +- `COREHOST_TRACE_VERBOSITY` - see [`DOTNET_HOST_TRACE_VERBOSITY`](#dotnet_host_trace). The typical way to get detailed trace information about application startup is to set `COREHOST_TRACE=1` and`COREHOST_TRACEFILE=host_trace.txt` and then run the application. A new file `host_trace.txt` will be created in the current directory with the detailed information. From 108d874531d3e3799cf0d24df375ae8e91b3d7b7 Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Mon, 28 Jul 2025 13:50:59 -0700 Subject: [PATCH 5/6] Update docs/core/tools/dotnet-environment-variables.md --- docs/core/tools/dotnet-environment-variables.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/core/tools/dotnet-environment-variables.md b/docs/core/tools/dotnet-environment-variables.md index d3982ce15416b..d3a0a931c55d9 100644 --- a/docs/core/tools/dotnet-environment-variables.md +++ b/docs/core/tools/dotnet-environment-variables.md @@ -423,8 +423,6 @@ Controls diagnostics tracing from the hosting components, such as `dotnet.exe`, - `COREHOST_TRACEFILE` - see [`DOTNET_HOST_TRACEFILE`](#dotnet_host_trace). - `COREHOST_TRACE_VERBOSITY` - see [`DOTNET_HOST_TRACE_VERBOSITY`](#dotnet_host_trace). -The typical way to get detailed trace information about application startup is to set `COREHOST_TRACE=1` and`COREHOST_TRACEFILE=host_trace.txt` and then run the application. A new file `host_trace.txt` will be created in the current directory with the detailed information. - ### `SuppressNETCoreSdkPreviewMessage` If set to `true`, invoking `dotnet` won't produce a warning when a preview SDK is being used. From d7636fed1197856a12b8d5b72d6411ca34205152 Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Tue, 29 Jul 2025 12:04:50 -0700 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/dependency-loading/default-probing.md | 2 +- docs/core/tools/dotnet-environment-variables.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/dependency-loading/default-probing.md b/docs/core/dependency-loading/default-probing.md index a07ca38ed5bcd..00cd01190ba19 100644 --- a/docs/core/dependency-loading/default-probing.md +++ b/docs/core/dependency-loading/default-probing.md @@ -50,7 +50,7 @@ The .NET Core runtime host will output useful trace messages when certain enviro |`DOTNET_HOST_TRACEFILE=` |Traces to a file path instead of the default `stderr`.| |`DOTNET_HOST_TRACE_VERBOSITY` |Sets the verbosity from 1 (lowest) to 4 (highest).| -See [DOTNET_HOST_TRACE environment variables](../tools/dotnet-environment-variables.md#dotnet_host_trace) for details. +For more information, see [DOTNET_HOST_TRACE environment variables](../tools/dotnet-environment-variables.md#dotnet_host_trace). ## Managed assembly default probing diff --git a/docs/core/tools/dotnet-environment-variables.md b/docs/core/tools/dotnet-environment-variables.md index d3a0a931c55d9..db7356bfe0974 100644 --- a/docs/core/tools/dotnet-environment-variables.md +++ b/docs/core/tools/dotnet-environment-variables.md @@ -397,7 +397,7 @@ Specifies whether .NET SDK local tools search for tool manifest files in the roo ### `DOTNET_HOST_TRACE` -**This variable applies to .NET 10 and later versions.** For older versions, replace the `DOTNET_HOST_` prefix with `COREHOST_`. See [`COREHOST_TRACE`](#corehost_trace). +**This variable applies to .NET 10 and later versions.** For older versions, replace the `DOTNET_HOST_` prefix with [`COREHOST_`](#corehost_trace). Controls diagnostics tracing from the hosting components, such as `dotnet.exe`, `hostfxr`, and `hostpolicy`.