dotnet / dotnet/dotnet-api-docs

TraceSwitch value is not read from config

Open
#7,970 6 comments 0 reactions 0 assignees View on GitHub
area-System.Diagnostics documentation Pri3
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

### Description

Unlike what [docs](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.traceswitch.-ctor?view=net-6.0) TraceSwitch value is not read from app.config.

I have created a repro here: https://github.com/aliostad/TraceSwitchDoesNotWork

### Reproduction Steps

Add system.diagnostics switch to the config and then in the code create a `TraceSwitch` with that name. Value is not read.

As in the repro https://github.com/aliostad/TraceSwitchDoesNotWork

### Expected behavior

Reading value Error (1)

### Actual behavior

Reading value Off (0) - perhaps just the default

### Regression?

I tried netcoreapp3.1 and it was the same

### Known Workarounds

None

### Configuration

.NET 6.0 on mac, x64

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.