Broken name suggestions in VS2019

This post details how I fixed an issue in Visual Studio 2019 where variable name suggestions were completely wrong. It may help you, and it may not. Anyways here goes

Example of what was wrong: The suggested variable name is completely wrong

The problem

You quickly become accustomed to Visual Studio (VS) writing half of your code. For example, when declaring a function with a specific type, you’ll expect VS to suggest a variable name based on that type. If, for example, I start to type public void SetContext(WebContext…)
then I expect VS to suggest things like ‘webContext, context, ctx’. In this case, it didn’t.

I find myself tending to search for complex solutions to simple problems, and so I started to disable every single extension that I have in VS in the hopes of fixing the problem. As you know, disabling an extension in VS means you need to restart it… One hour later, and I still had the same problem, now with all extensions disabled!

Solution:

What fixed this for me was a simple deletion of the hidden .vs file, along with the obj and bin folders. The documentation states that the .vs folder contains, among other things, the intellisense cache, but I found that ONLY deleting this folder wasn’t enough. Clearing the bin and obj folders in the same swoop (and mind you – VS has to be closed when you do this!) solved the problem.

So, I made this small post to remind myself to keep it simple 🙂

About digitaldias

Software Engineer during the day, photographer, videographer and gamer in the evening. Also a father of 3. Pedro has a strong passion for technology, and gladly shares his findings with enthusiasm.

View all posts by digitaldias →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.