Visual Studio 2019 16.10 Find All References Error

one soul 21 Reputation points
2021-06-21T09:11:06.803+00:00

After I updated from 16.9 to 16.10, there was an error in finding all references,

C # in case (int) someenum.none:, find the reference of none in switch () case, the reference number of finding "case (int) someenum.none" will be displayed, with the reference times of 0

In 16.9, it is normal, and all references of someenum.none will be displayed normally

This is repeated as follows

public enum SomeEnum

{

None,

}

public void TestSwitch()

{

var a = (int)SomeEnum.None; // one

swicth(1)

{

case (int)SomeEnum.N one:break; // two

}

}

At this time, if you right-click none in line 1 to find all references, you will find two, 1 and 2.

However, if you right-click none in 2 to find all references, you will find them with the whole tag case (int) someenum. None, and the reference is 0

This is not the case in 16.9

我从16.9更新到16.10以后,查找所有引用出错,
c#中,如果在switch() case中 case (int)SomeEnum.None:, 查找None的引用,就会显示查找“ case (int)SomeEnum.None”这整个标签的引用,引用次数就是0
而在16.9时,就是正常的,会正常显示SomeEnum.None的所有引用
复现如下
public enum SomeEnum
{
None,
}

public void TestSwitch()
{
var a = (int)SomeEnum.None; //1
swicth(1)
{
case (int)SomeEnum.None:break; //2
}
}
这个时候,如果在1行中右键None查找所有引用,就会找到两个,1,2这两个。
但是如果在2中右键None查找所有引用,就会以 case (int)SomeEnum.None 这整个标签查找,引用为0
这个情况在16.9中没有

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,888 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,648 questions
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 29,446 Reputation points Microsoft Vendor
    2021-06-22T04:57:52.747+00:00

    Hi @one soul ,

    Welcome to Microsoft Q&A forum.

    I tested with VS 2019 previous version and VS 2019 16.10.1, and I can reproduce this issue. In 16.10.1 version, the case (int)SomeEnum.None: was identified as a label, so Find All References feature search for the reference to case (int)SomeEnum.None:.

    This change may be from the improvement of Intellisense feature of Visual Studio 2019, but after I checked the related options, release notes, I didn’t find any possible option to disable this feature.

    I have started a new thread on our Developer Community and reported this issue to Visual Studio Product Team, here is the link. Please kindly follow that thread and wait for VS Product Team’s reply.

    Thanks for helping us make VS better.

    Best Regards,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful