Visual studio 2019 go to definition and Intellisense not working

前端 未结 10 1329
余生分开走
余生分开走 2021-01-18 06:21

I have noticed a weird issue with Visual Studio 2019 v16.0.1 the IntelliSense about \"Using directive is unnecessary\" normally grey is missing and type reference suggestion

相关标签:
10条回答
  • 2021-01-18 06:56

    For anyone who are searching for another suggestion, I just go throught this issue, as OP said, I've deleted .vs folder, I've update vs to last version, I've uninstalled and reinstalled vs to the last version, I've reset settings, delete all obj folders, I've installed Microsoft.Net.Compilers but nothing worked, at the end I just remembered that sometimes the projects required WindowsBase library, until now I don't know why, but after adding that dll Intellisense started to function again.

    0 讨论(0)
  • 2021-01-18 06:59

    I think these issues are discussed here and are resolved by an update and some worksrounds are bring discussed:

    https://developercommunity.visualstudio.com/content/problem/505489/cannot-navigate-to-the-symbol-under-the-caret-3.html

    0 讨论(0)
  • 2021-01-18 07:00

    I tried lots of things but nothing worked for me until I found this post. He mentions a few things I have already tried that didn't work, but his final solution worked for me...

    At the root of our solution there is a packages folder. I deleted the entire contents of this folder. Upon reopening Visual Studio, Intellisense and Go To Definition were restored to full working order.

    0 讨论(0)
  • 2021-01-18 07:00

    After working for a few months, Intellisense suddenly stopped. This cost me a lot of lost time! I've been worked with Visual Studio for about 10 years, and this problem happens occasionally in every version.

    Here's what I tried for this iteration of the problem:

    • Closing Visual Studio and re-opening does sometimes make the problem disappear for a short time, but it certainly doesn't solve it
    • Likewise restarting my laptop
    • Installing the latest Visual Studio 2019 update didn't help (I'm on 16.8.3 now if anyone's interested)
    • Deleting the hidden .vs folder doesn't seem to solve anything (doing so also means you lose your current window layout, as well as any bookmarks you've set)
    • Unticking the Track Changes option in this menu: Tools-> Options-> Text Editor-> General.
    • I've updated my NuGet reference to the Microsoft.Net.Compilers library to the latest stable version, as suggested here, but sadly this made no difference

    I thought I've finally solved the problem by following the advice from Homer. I deleted the packages folder at the base level of my project (somewhat nervously, as I wasn't sure if it was needed), and thought it had solved the problem, but no such luck.

    However, one thing to watch out for - after doing this, Visual Studio recognised my classes but no longer recognised built-in ones (all the referenced namespaces at the top of my controllers were underlined in red). I then deleted the .vs folder (again), which seemed to solve the problem.

    When I recompiled my solution, it gave a few CS0433 compilation errors with duplicate namespaces for the MinLength and MaxLength directives in some identity user name and password validation code. I got round this by removing the Microsoft.EntityFramework Nuget library (I had to also remove Microsoft.AspNet.Identity.EntityFramework too, since this depended on it), then adding them both back in, making sure to include at least version 6.2 of the former (otherwise I got another runtime error to do with the FirstOrDefaultAsync method called somewhere!).

    My current situation: all existing Intellisense is working, but it's not recognising new classes I add unless I exit Visual Studio and go back in again. May have to live with this ... unless anyone can help me?

    0 讨论(0)
提交回复
热议问题