CA2252 warnings with .NET 7 RC1 SDK
See original GitHub issueVersion Used: .NET 7 RC1 SDK
Steps to Reproduce:
- Clone the .NET Community Toolkit at https://github.com/CommunityToolkit/dotnet/commit/338172af682a5910ca33962211be1751d0dd2008
- Run
dotnet build
on the solution
Expected Behavior:
The solution should build fine like it did up until now.
Actual Behavior:
A whole bunch of CA2252 warnings from the CommunityToolkit.HighPerformance.UnitTests project. This is using a bunch of types from CommunityToolkit.HighPerformance that are marked as [RequiresPreviewFeatures]
, but the test project using it is using <EnablePreviewFeatures>
in the .csproj, so I’m not really sure why with the .NET 7 SDK this is causing issues.
Failing CI run: https://dev.azure.com/dotnet/CommunityToolkit/_build/results?buildId=78431&view=results.
cc. @333fred
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
ASP.NET Core updates in .NET 7 Release Candidate 1
NET 7 Release Candidate 1 (RC1) is now available and includes many great new improvements to ASP.NET Core. Here's a summary of what's...
Read more >Net | PDF | Xml | Microsoft Visual Studio
NET SDK Overview Environment variables dotnet-install scripts ... Windows 7 SP1 ESU - Microsoft Visual C++ 2015-2019 Redistributable 64-bit /.
Read more >SDK Resolver Failure - Net 7 - Net 6
Just downloaded and installed SDK Net 7.0.100 and it broke existing applications and they won't load any more in VS 2022 or Rider....
Read more >First .NET 7 Release Candidate Ships
Microsoft said .NET 7 RC1 has been tested with Visual Studio 17.4 Preview 2, recommending that developers use the preview channel builds to...
Read more >Discover .NET 7 (RC1) New Features – Release Candidate 1
Discover the latest updates of .NET 7 Release Candidate 1 and check the top 10 new features that will enhance your coding experience....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, you’re right @Youssef1313!
The key section is here: https://github.com/dotnet/designs/blob/main/accepted/2021/preview-features/preview-features.md#meaning-of-property-in-multi-targeted-projects
This design detail was intended to handle scenarios around preview features that ship as part of the .NET SDK. The reported issue here does not involve .NET SDK preview feature, but the logic gets applied nonetheless.
The workarounds are to either target
net7.0
or use the .NET 6 SDK. We should consider updating that logic to avoid this pitfall, but I think that would be out of scope for .NET 7 at this point.I guess https://github.com/dotnet/designs/pull/232 explains it. It looks by-design?