dotnet / dotnet/roslyn

ErrorLog option changes which warnings are reported

Open
#80,301 1 comment 1 reaction 1 assignee Claimed by @JoeRobich View on GitHub
Area-Analyzers
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**: .NET 10 RC1

**Steps to Reproduce**:

Create a program with:

```cs
C? c = null;
if (c != null)
{
c.F = 1;
}

class C
{
public int F;
}
```

Set `EnforceCodeStyleInBuild=true`.

Add `.globalconfig`:

```ini
dotnet_style_null_propagation = true:suggestion
dotnet_diagnostic.IDE0031.severity = warning
```

Run `dotnet build` - no IDE0031 is reported ("suggestion" severity wins I guess).

Run `dotnet build -p:ErrorLog=error.log` - warning IDE00031 is reported (failing the build when WarnAsError is enabled).

**Expected Behavior**: IDE0031 is either reported in both cases or neither of them.

**Actual Behavior**: `ErrorLog` option affects whether the warning is reported which seems unexpected.

**Note**: This is a simplified repro from build failures seen in the runtime repo.

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.