Skip to content

Pragma warnings IDE0028, IDE0305, IDE0301 to prefer collection expressions should not pop up when current editor target is less net9 #78892

Open
@vsfeedback

Description

@vsfeedback

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.

2025-06-09 15_13_47-DevTKSS.Inventor - FluentRowBuilder.cs - Microsoft Visual Studio.png

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEuntriagedIssues and PRs which have not yet been triaged by a lead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions