---
url: /reference/coverage-profilers/teamscale-dotnet-profiler/config-reference.md
---

# Configuration Reference

Complete reference for all Teamscale .NET Profiler and Upload Daemon configuration options.

***

\[\[toc]]

## Registration Variables

These variables register the profiler with the .NET runtime.
They must be set as environment variables and cannot be specified in the configuration file.

### .NET Framework

| Environment variable | Value | Description |
| :--- | :--- | :--- |
| `COR_ENABLE_PROFILING` | `1` | Enables the profiler |
| `COR_PROFILER` | `{DD0A1BB6-11CE-11DD-8EE8-3F9E55D89593}` | GUID identifying the profiler DLL |
| `COR_PROFILER_PATH_32` | Path | Path to `Profiler32.dll` |
| `COR_PROFILER_PATH_64` | Path | Path to `Profiler64.dll` |

### .NET Core

| Environment variable | Value | Description |
| :--- | :--- | :--- |
| `CORECLR_ENABLE_PROFILING` | `1` | Enables the profiler |
| `CORECLR_PROFILER` | `{DD0A1BB6-11CE-11DD-8EE8-3F9E55D89593}` | GUID identifying the profiler DLL |
| `CORECLR_PROFILER_PATH_32` | Path | Path to `Profiler32.dll` |
| `CORECLR_PROFILER_PATH_64` | Path | Path to `Profiler64.dll` |

### Config file path

| Environment variable | Default | Description |
| :--- | :--- | :--- |
| `COR_PROFILER_CONFIG` | `Profiler.yml` next to DLLs | Path to the YAML configuration file |

## Profiler Options

Set under the `profiler:` key in each `match` section of the configuration file.

```yaml
match:

  # ...

  profiler:
    enabled: true
    targetdir: 'C:\Users\Public\Traces'
    upload_daemon: true
```

Each option can also be set as an environment variable: `COR_PROFILER_` + the option name uppercased (e.g. `targetdir` → `COR_PROFILER_TARGETDIR`) or `CORECLR_PROFILER_` + the option name uppercased.
Both prefixes work regardless of whether your profiled application runs on .NET Framework or .NET Core.
This allows using the same prefix for option configuration that you are using for your profiler registration.

| YAML key | Env var | Default | Description |
| :--- | :--- | :--- | :--- |
| `enabled` | — | `true` | Enable or disable profiling for processes matching this section |
| `targetdir` | `COR_PROFILER_TARGETDIR` | `C:\Users\Public` | Directory where trace files are written. `C:\Users\Public` is writable by all Windows user accounts by default. |
| `light_mode` | `COR_PROFILER_LIGHT_MODE` | `true` | Enables ultra-light mode by disabling re-jitting of assemblies. Disable only if you use the Native Image Cache. |
| `assembly_paths` | `COR_PROFILER_ASSEMBLY_PATHS` | `true` | Records assembly paths in trace files. Required for `@AssemblyDir` to work in the Upload Daemon — enabled by default for this reason. |
| `assembly_file_version` | `COR_PROFILER_ASSEMBLY_FILE_VERSION` | `false` | Prints the file and product version of loaded assemblies in trace files. |
| `eagerness` | `COR_PROFILER_EAGERNESS` | `0` | When > 0, writes trace data to disk after every N method calls instead of waiting for process shutdown. Use in environments where the .NET runtime is killed rather than shut down gracefully. Combine with `light_mode`. |
| `upload_daemon` | `COR_PROFILER_UPLOAD_DAEMON` | `false` | Enables the Upload Daemon |
| `dump_environment` | `COR_PROFILER_DUMP_ENVIRONMENT` | `false` | Prints all environment variables of the profiled process in trace files |
| `tga` | `COR_PROFILER_TGA` | `true` | Enables regular coverage collection. Method coverage is recorded at all times. This is the default mode used for [Test Gap Analysis](../../../../glossary/#test-gap-analysis). |
| `tia` | `COR_PROFILER_TIA` | `false` | Enables TIA mode, where coverage is collected per test case ([testwise coverage](../../../../glossary/#testwise-coverage)). See [Testwise Coverage (TIA Mode)](../#testwise-coverage-tia-mode). |
| `tia_request_socket` | `COR_PROFILER_TIA_REQUEST_SOCKET` | `tcp://127.0.0.1:7145` | Socket address used to communicate test start and stop events to the profiler in TIA mode. |

## Upload Daemon Options

Set under the `uploader:` key in each `match` section of the configuration file.

```yaml
match:

  # ...

  uploader:
    pdbDirectory: '@AssemblyDir'
    revisionFile: 'C:\my\application\revision.txt'
    uploadIntervalInMinutes: 60
```

Most of the options must be set in the configuration file and cannot be specified as environment variables.
The only exceptions are the Teamscale credentials, see [Teamscale](#teamscale).
Unlike the [profiler options](#profiler-options), these names are case-sensitive camel case.

| YAML key | Default | Description |
| :--- | :--- | :--- |
| `pdbDirectory` | required | Directory containing PDB files used for coverage conversion. `@AssemblyDir` resolves to the directory of each loaded assembly (requires `assembly_paths: true`). |
| `revisionFile` | required | Path to a file containing the code revision of the deployed build. `@AssemblyDir` scans assembly directories in load order for the first match. See [revision file formats](#revision-file-formats). |
| `assemblyPatterns.include` | all assemblies | Glob patterns for assembly names to include. `*` = any characters, `?` = one character. Matched against name without extension. |
| `assemblyPatterns.exclude` | none | Glob patterns for assembly names to exclude. |
| `uploadIntervalInMinutes` | `5` | How often finished traces are uploaded. Set to `0` to disable scheduled uploads (manual-only mode). |
| `disableSslValidation` | `true` | Disables SSL certificate validation. Set to `false` in production. Disabled by default to simplify setup in environments with self-signed certificates. |
| `mergeLineCoverage` | `true` | Merges all coverage going to the same destination into a single file before upload, reducing upload count and disk usage. |

### Revision file formats

The revision file contains a single line in one of these formats:

| Format | Example | Description |
| :--- | :--- | :--- |
| `revision: HASH` | `revision: abc123def456` | VCS [revision](../../../../glossary/#revision) (Git SHA1 or TFS changeset ID) |
| `timestamp: BRANCH:MS` | `timestamp: master:1672531200000` | [Unix timestamp](../../../../glossary/#java-timestamp-unix-timestamp) in milliseconds with branch name |

### Proxy settings

By default, the Upload Daemon uses the system-wide proxy settings.
To route uploads through a different proxy, or through no proxy at all, uncomment and adjust one of the `defaultProxy` examples in the `<system.net>` section of `UploadDaemon\UploadDaemon.exe.config`.
Proxy configuration lives in this file rather than in `Profiler.yml` because it is read by the .NET runtime, not by the Upload Daemon itself.
See the [`defaultProxy` element reference](https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/network/defaultproxy-element-network-settings) for all available options.

### Logging

The Upload Daemon writes `UploadDaemon.log` to the directory containing `UploadDaemon.exe`.
The log is rotated regularly and earlier logs are stored as `UploadDaemon.<number>.log`.

Logging is configured in `nlog.config` in the same directory, which is reloaded automatically while the daemon is running.
By default, only warnings and errors are logged.
Lower the `minlevel` of the `logger` rule to `Info` or `Debug` when diagnosing upload problems.

`nlog.config` also contains commented-out filters that suppress warnings about symbols which could not be resolved in a trace file.
Enable them if your PDB files legitimately lack symbols for some methods, for example for unmanaged or compiler-generated code, and the resulting warnings drown out the rest of the log.

## Upload Destinations

Determine where finished trace files are uploaded to.
Configure exactly one destination under `uploader:`.

### Teamscale

```yaml
uploader:
  teamscale:
    url: 'http://teamscale.example.com'
    username: 'build'
    accessKey: 'your-access-key'
    project: 'my-project'
    partition: 'Manual Tests'
```

| YAML key | Env var | Description |
| :--- | :--- | :--- |
| `teamscale.url` | — | HTTP(S) URL of the Teamscale instance |
| `teamscale.username` | `TEAMSCALE_USER` | Teamscale username |
| `teamscale.accessKey` | `TEAMSCALE_ACCESSKEY` | User's [access key](../../../../glossary/#access-key) |
| `teamscale.project` | — | Teamscale project alias or ID |
| `teamscale.partition` | — | Target [partition](../../../../glossary/#partition) |

Providing the credentials as environment variables avoids storing the access key on disk, e.g. when the configuration file is checked into a repository or the credentials are injected by a CI system.
Each variable overrides the corresponding key and is resolved independently of the other, so you can keep `username` in the configuration file and supply only the access key via the environment.
An empty variable counts as unset.
If both environment variables are set, `username` and `accessKey` may be omitted entirely:

```yaml
uploader:
  teamscale:
    url: 'http://teamscale.example.com'
    project: 'my-project'
    partition: 'Manual Tests'
```

The variables must be visible to the Upload Daemon process, not to the profiled application.

### File Storage Upload

In case the .NET Profiler is unable to directly upload coverage to Teamscale, you can also upload it to your file storage solution.

#### Artifactory

```yaml
uploader:
  artifactory:
    url: 'https://yourinstance.jfrog.io/artifactory/some/path'
    apiKey: 'somekey'
    partition: 'Manual Tests'
```

| YAML key | Description |
| :--- | :--- |
| `artifactory.url` | Artifactory repository URL |
| `artifactory.apiKey` | API key (preferred) |
| `artifactory.username` | Username (alternative to `apiKey`) |
| `artifactory.password` | Password (alternative to `apiKey`) |
| `artifactory.partition` | Partition name for Teamscale's Artifactory connector |
| `artifactory.pathSuffix` | Optional path appended to the URL |

#### Network share

```yaml
uploader:
  directory: '\\yourserver.localdomain\coverage'
```

| YAML key | Description |
| :--- | :--- |
| `directory` | Path to a network share or local directory |

#### Azure File Storage

```yaml
uploader:
  azureFileStorage:
    connectionString: 'DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;'
    shareName: 'my-share'
    directory: 'log/file/path'
```

| YAML key | Description |
| :--- | :--- |
| `azureFileStorage.connectionString` | Azure storage [connection string](https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string) |
| `azureFileStorage.shareName` | Azure file share name |
| `azureFileStorage.directory` | Directory within the share |

## Archiving Options

Determine when processed trace files are archived to a separate folder.
Set at the top level of the configuration file (not inside a `match` section).

| YAML key | Default | Description |
| :--- | :--- | :--- |
| `archivePurgingThresholdsInDays.uploadedTraces` | indefinite | Days to retain successfully uploaded traces. `0` = purge immediately after processing. |
| `archivePurgingThresholdsInDays.emptyTraces` | indefinite | Days to retain empty traces (no coverage recorded). |
| `archivePurgingThresholdsInDays.incompleteTraces` | indefinite | Days to retain traces that could not be processed. |
| `archiveLineCoverage` | `false` | Write generated coverage files to disk for debugging. These files are never purged automatically. |

Example:

```yaml
archivePurgingThresholdsInDays:
  uploadedTraces: 7
  emptyTraces: 3
  incompleteTraces: 3
```
