-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Description
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.
pentp