Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TargetFramework net7.0 disables all CAxxxx rules #6245

Closed
znakeeye opened this issue Nov 3, 2022 · 3 comments · Fixed by #6246
Closed

TargetFramework net7.0 disables all CAxxxx rules #6245

znakeeye opened this issue Nov 3, 2022 · 3 comments · Fixed by #6246
Assignees
Labels
Bug The product is not behaving according to its current intended design Priority:0 Critical to the release Reliability Indicates a reliability issue (crash/data loss/test flakiness) Urgency-Soon
Milestone

Comments

@znakeeye
Copy link

znakeeye commented Nov 3, 2022

Just bumped my project to .NET 7.0 RC2 (running VS Version 17.4.0 Preview 6.0), and realized that all code analysis rules are disabled, no matter the settings. Downgrading the project to net6.0 re-enables all CAxxxx rules.

Steps To Reproduce

Just create a console project with some CAxxxx violations, and target net7.0. No warnings are produced. Downgrade to net6.0 to get the warnings back.

<PropertyGroup>
   <!--TargetFramework>net6.0</TargetFramework-->
   <TargetFramework>net7.0</TargetFramework>

   <OutputType>Exe</OutputType>
   <LangVersion>latest</LangVersion>
   <ImplicitUsings>enable</ImplicitUsings>
   <Nullable>enable</Nullable>
   <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
   <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
   <AnalysisMode>AllEnabledByDefault</AnalysisMode>
   <WarningLevel>9999</WarningLevel>
</PropertyGroup>

Expected behavior

CAxxxx rules are checked when targeting .NET 7.

Actual behavior

CAxxxx rules are checked only when targeting .NET 6 or earlier.

@mavasani
Copy link
Contributor

mavasani commented Nov 3, 2022

@znakeeye Thank you so much for reporting the issue. I have created a PR that should fix this issue once the fix flows into dotnet/sdk repo. @jmarolf Can we ensure the flow into the SDK repo happens asap? Do we need any approvals here?

As a side note, I am going to enhance the tooling so such a regression does not happen in future. Our generated editorconfig files that we ship in the package should most likely include a vNext set of editorconfig files so that when the analysis level is set to latest or explicitly to vNext, we still find a proper mapped editorconfig file.

@mavasani
Copy link
Contributor

mavasani commented Nov 3, 2022

Filed #6247

@mavasani mavasani added Bug The product is not behaving according to its current intended design Urgency-Soon Priority:0 Critical to the release labels Nov 3, 2022
@mavasani mavasani self-assigned this Nov 3, 2022
@mavasani mavasani added the Reliability Indicates a reliability issue (crash/data loss/test flakiness) label Nov 3, 2022
@mavasani mavasani added this to the .NET 7.x milestone Nov 3, 2022
@znakeeye
Copy link
Author

znakeeye commented Nov 3, 2022

Many thanks for the fix. I actually saw this problem some months back, but went back to net6.0 and forgot about it. Glad I reported it 😄

mavasani added a commit to mavasani/roslyn-analyzers that referenced this issue Nov 11, 2022
…obalconfig files

Fixes dotnet#6247

Our generated globalconfig files that we ship in the analyzer NuGet packages and .NET SDK should likely include a vNext set of globalconfig files so that when the analysis level is set to latest or explicitly to vNext for upcoming .NET Release, we still find a proper mapped globalconfig file. This will avoid regressions such as dotnet#6245 in future.

Verified that locally built Microsoft.CodeAnalysis.NetAnalyzers package with this change includes globalconfig files specific to 8.0 release version.
mavasani added a commit to mavasani/roslyn-analyzers that referenced this issue Nov 11, 2022
…obalconfig files

Fixes dotnet#6247

Our generated globalconfig files that we ship in the analyzer NuGet packages and .NET SDK should likely include a vNext set of globalconfig files so that when the analysis level is set to latest or explicitly to vNext for upcoming .NET Release, we still find a proper mapped globalconfig file. This will avoid regressions such as dotnet#6245 in future.

Verified that locally built Microsoft.CodeAnalysis.NetAnalyzers package with this change includes globalconfig files specific to 8.0 release version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The product is not behaving according to its current intended design Priority:0 Critical to the release Reliability Indicates a reliability issue (crash/data loss/test flakiness) Urgency-Soon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants