Visual Studio doesn't hint references to Local Functions

Antonio Vidal Carrasco 21 Reputation points

Recently I started using Local Functions because I see a lot of benefit for hiding logic that only affects to a method inside that same method.

But after a while, I started to notice a big drawback of using it that is making me doubt about the utility of these methods and it's not related to performance or the code itself.

It's related to the support that the IDE give to them.
In my case I tried in Visual Studio 2022 and Visual Studio Code.
The problem is that I can't use "Go to all", the class view (I think this is normal) or even the hints for usage are not there, so I can't not know if the method is used or not used just by looking at it.

This is very annoying as I like to navigate using these shortcuts and when I have several of them that I want to jump from one to another, it gets very annoying.

I tried to find more people on the internet with the same problem but I couldn't so I was surprised.

Do you think this could be supported in the future?


Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,766 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anna Xiu-MSFT 27,256 Reputation points Microsoft Vendor

    Hi @Antonio Vidal Carrasco ,

    Welcome to Microsoft Q&A!

    I tested it on my side. I suppose it is designed like this. The reference is not supported on local functions in C#.
    If you have any suggestion about the feature, you can directly report it to product team by selecting “Help” menu > Send Feedback.

    By the way, I click on Edit > Go To > Go To All… > type “squ” > it shows as follows:

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Antonio Vidal Carrasco 21 Reputation points

    Hello Anna,
    Thank you for taking your time to answer.

    It's very weird that you can see the local methods in "Go To All".
    I followed your steps and still I can't see them and, by the picture, it seems that your methods is actually a private method, not a local one.
    Maybe you can share your code?

    I will use the “Help” menu > Send Feedback menu, as you said!