Skip to content

Intellisense compoud assignment suggestion incorrect #53969

@vsfeedback

Description

@vsfeedback

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


[severity:Other]
For this code Intellisense suggest to use compound assignment, but it changes the behavior of the code.
Original code:

            bool alwaysTrue = true;
            int pkOrder = 0;
            int? current = null;
            for (int i = 0; i < 10; i++)
            {
                current = alwaysTrue == true ? pkOrder = pkOrder + 1 : null;
                Console.WriteLine(current);
            }

Results the following output:
1
2
3
4
5
6
7
8
9
10

Intellisense suggestion for this:

            bool alwaysTrue = true;
            int pkOrder = 0;
            int? current = null;
            for (int i = 0; i < 10; i++)
            {
                current = alwaysTrue == true ? pkOrder++ : null;
                Console.WriteLine(current);
            }

Results:

0
1
2
3
4
5
6
7
8
9


Original Comments

Feedback Bot on 6/8/2021, 06:22 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.


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEBughelp 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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions