Description
This issue has been moved from a ticket on Developer Community.
[severity:It bothers me. A fix would be nice]
As https://developercommunity.visualstudio.com/t/IDE0301-Warning-wrong-suggestion/10524090 is closed for upvoting, filing this here to re-enable this as its quite annoying behavior to me from vs2022
If I have net8 + net9 TargetFramework for backwards compartibility reasons, the IDE pragma warnings to prefer collection expressions are popping up also if I set the editor target to net 8 AND use #if like shown in the screenshot added here. I should not be needed to constantly add a #pragma warning disable + restore just that Visual Studio dont mistakenly list them in my Problem List.
Those warnings overflowing in this list can potenially lead to overseeing some warnings that should get addressed and are right to be there
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0; net9.0</TargetFrameworks>
<OutputType>Library</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Microsoft Visual Studio Community 2022 (64-Bit) - Current
Version 17.14.4
VisualStudio.17.Release/17.14.4+36202.13
Microsoft .NET Framework
Version 4.8.09032
Installierte Version: Community
Original Comments
Feedback Bot on 6/9/2025, 10:15 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Feedback Bot on 6/10/2025, 06:37 AM:
This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.