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
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!
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 🙂