dotnet / dotnet/sdk

Inevitable breaking changes because of code analysis and TreatWarningsAsErrors=true

Open
#45,453 5 comments 0 reactions 1 assignee Assigned to @JoeRobich View on GitHub
Area-NetSDK
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

## Describe the bug

In my `.csproj` file, I have:

```xml
net8.0
12
true
8.0
all
```

The build is fine for SDK 8.0.1xx versions. For higher SDK versions (8.0.2xx, 8.0.3xx, 8.0.4xx, 9.0.100) the build breaks due to new code analysis warnings that are treated as errors.

The only way of solving this issue is to fix the SDK version range via the `global.json` file. This introduces friction for developers and devops who are forced to maintain old SDK versions side-by-side with new SDK versions (for other projects) on development and build machines.

New SDK versions should not enable new code analysis rules by default, or at least there should be a switch to opt out of this practice.

For people with `TreatWarningsAsErrors` enabled, the current update policy is as bad as it would be to make backwards-incompatible compiler changes within the same major version.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.