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

IDE0028/IDE0300 is not reported for overloaded methods #73362

Open
cremor opened this issue May 7, 2024 · 0 comments
Open

IDE0028/IDE0300 is not reported for overloaded methods #73362

cremor opened this issue May 7, 2024 · 0 comments
Labels
Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
Milestone

Comments

@cremor
Copy link

cremor commented May 7, 2024

Version Used: Visual Studio 17.9.6, SDK 8.0.204

Steps to Reproduce:
.editorconfig:

dotnet_style_prefer_collection_expression = when_types_loosely_match

Code:

    public void Test(Class1 param1, Class1 param2)
    {
        // Should show IDE0300 but doesnt't
        MethodTakingEnumerable(new[] { param1, param2 });
        MethodTakingEnumerable(new Class1[] { param1, param2 });

        // Should show IDE0028 but doesnt't
        MethodTakingEnumerable(new List<Class1> { param1, param2 });
    }

    public void MethodTakingEnumerable(IEnumerable<Class1> param)
    {
    }

    public void MethodTakingEnumerable(IEnumerable<Class2> param)
    {
    }

    public class Class1 { }
    public class Class2 { }

Diagnostic Id:
IDE0028: Use collection initializers or expressions
IDE0300: Use collection expression for array

Expected Behavior:
Method calls to overloaded methods should show IDE0028/IDE0300 analyzer diagnostics.

Actual Behavior:
Method calls to overloaded methods do not show IDE0028/IDE0300 analyzer diagnostics.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels May 7, 2024
@CyrusNajmabadi CyrusNajmabadi added help wanted The issue is "up for grabs" - add a comment if you are interested in working on it and removed untriaged Issues and PRs which have not yet been triaged by a lead labels May 7, 2024
@CyrusNajmabadi CyrusNajmabadi added this to InQueue in Small Fixes via automation May 7, 2024
@CyrusNajmabadi CyrusNajmabadi added this to the Backlog milestone May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
Small Fixes
  
InQueue
Development

No branches or pull requests

2 participants