VS 2015 Razor Autocomplete/Intellisense dropdown h

2019-01-21 16:06发布

In VS 2015, only when in Razor (.cshtml) files, roughly half of the time the autocomplete/suggestion list/intellisense doesn't work correctly (sorry, not sure the actual term... when you type an object and hit . and the list of properties and methods shows to select from)

The behavior is that when I hit ., the list popups up for a fraction of a second and then closes. It happens so fast I try to do a quick Backspace, ., Backspace, . cycle a few times to at least see the name I need, but I usually cant' get it and end up having to find the exact name elsewhere from code. Extremely irritating...

It happens sporadically with no real pattern I can find. Here's patterns that I've ruled out:

  • The file that's open doesn't seem to matter.
  • Whether or not I close/reopen the file doesn't seem to matter
  • Whether I navigate to another file and back doesn't seem to matter
  • It will work/not work multiple times on and off throughout the same file
  • It doesn't seem to be relevant to any particular object/property/method

I've checked all my options (there doesn't seem to be Text Editing options for Razor?), have tried clearing caches, the reloading solution/projects, restarting VS, all of which seem to still provide no pattern.

Has anyone come across this and have any ideas of where else I can look to fix it?

Example Here's an extremely simple example... new project, very little code/files, very simple view. Where the Model. stops, I should have the usual base methods, and an 'Items' collection. It pops up for a split second then disappears... no lambdas/complex view parsing involved (this is reproducible as well):

enter image description here

Update: Patterns

Things I've noticed:

  • If I'm entering a @model ns.ns.ns.type, it rarely happens toward the "base" end of the namespaces. It's as I get further towards the type that it happens. This one is intermittent.
  • In some cases, it works perfectly fine, every single time. For example, I often use DevExpress tools, and have never seen the behavior on any of their extensions (so, @Html.DevExpress(). (and other similar, not necessarily DevEx models) will never cause a problem)
  • It happens almost all the time when I'm accessing my @Model (which is where I most want it!). I've found some cases where this is reproducible every time (see above example), but it's about 90%+
  • Occasionally, as I work through the object tree, one will fail while the next works (ex: @models ProjName.Web.App.Subscriptions.Models.AccountCreateVM... it might fail on Subscriptions but work fine on Models)
  • Occasionally, beginning to type the name within autocomplete kicks it back into gear and it starts working again. In the above example, starting to type Acc for AccountCreateVM causes it to start working again.

8条回答
在下西门庆
2楼-- · 2019-01-21 16:56

Instead of...

@Html.Partial("ManageGrid", Model.)

Use...

@Html.Partial("ManageGrid", Model.
查看更多
ら.Afraid
3楼-- · 2019-01-21 16:58

I had the same error and I fixed it by deleting all the files of the component model cache.

This is the path:

Users\YourName\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

Hope that helps

查看更多
登录 后发表回答