Skip to content

ErrorLog option changes which warnings are reported #80301

@jjonescz

Description

@jjonescz

Version Used: .NET 10 RC1

Steps to Reproduce:

Create a program with:

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

class C
{
    public int F;
}

Set EnforceCodeStyleInBuild=true.

Add .globalconfig:

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.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions