Skip to content

Incorrect ID0004 - when constructing a ValueTuple which is then assigned to object #33143

@canton7

Description

@canton7

(Apologies if this has already been submitted: I couldn't find it in the issue list)

Version Used:

Visual Studio 15.9.4

Steps to Reproduce:

object x = (true, (IEnumerable<int>)new int[0]);

Expected Behavior:

IDE0004 does not fire.

Actual Behavior:

IDE0004 fires, suggesting:

object x = (true, new int[0]);

This creates a boxed (bool, int[]) instead of a boxed (bool, IEnumerable<int>).

Interestingly, this does not happen with var x = (true, (IEnumerable<int>)new int[0]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEBugIDE-CodeStyleBuilt-in analyzers, fixes, and refactoringshelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions