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

Invalid "Collection initialization can be simplified" #72483

Closed
vsfeedback opened this issue Mar 11, 2024 · 1 comment
Closed

Invalid "Collection initialization can be simplified" #72483

vsfeedback opened this issue Mar 11, 2024 · 1 comment
Labels
Area-IDE Resolution-Duplicate The described behavior is tracked in another issue untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


Given the following method:

public static TheoryData<string> Valid() {
    return new TheoryData<string> {
        $""
    };
}

I'm being given a code fix for IDE0028 on new saying that it can be simplified. If I apply it, I end up with this invalid code:

public static TheoryData<string> Valid() {
    return [
        $""
    ];
}

The string there has error CS0029: Cannot implicitly conver string to object[]


Original Comments

Feedback Bot on 3/10/2024, 09:55 PM:

(private comment, text removed)


Original Solutions

(no solutions)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 11, 2024
@sharwell
Copy link
Member

Duplicate of #71240

@sharwell sharwell marked this as a duplicate of #71240 Mar 11, 2024
@sharwell sharwell closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2024
@sharwell sharwell added the Resolution-Duplicate The described behavior is tracked in another issue label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Resolution-Duplicate The described behavior is tracked in another issue untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

2 participants