question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CA2252 warnings with .NET 7 RC1 SDK

See original GitHub issue

Version Used: .NET 7 RC1 SDK

Steps to Reproduce:

  1. Clone the .NET Community Toolkit at https://github.com/CommunityToolkit/dotnet/commit/338172af682a5910ca33962211be1751d0dd2008
  2. 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:closed
  • Created a year ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jeffhandleycommented, Sep 20, 2022

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.

1reaction
Youssef1313commented, Sep 20, 2022

I guess https://github.com/dotnet/designs/pull/232 explains it. It looks by-design?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found