Lack of intellisense for strongly typed model in razor mode
Ok, since for a couple of weeks I lost the intellisense on the model in my views.
I'm pretty sure this is not a problem with the code, because it works for another developer on the same project.
Suppose this class:
namespace Project.UI.ViewModels
{
public class TestViewModel
{
public int PropertyA { get; set; }
public string PropertyB { get; set; }
}
}
And this look:
@model Project.UI.ViewModels.TestViewModel <div> @Model.PropertyA </div>
When I type @Model.
in my mind I expect intellisense to show me PropertyA
and PropertyB
. Nothing happens.
However, if I type @Html.
, I have a list of methods for the HtmlHelper.
If I type @Model.Foo
, resharper prompts me to create a property Foo
on TestViewModel
.
I'm guessing there is some kind of Visual Studio module not working as expected to handle intellisense in razor views, but I can't see what.
I am working with Visual Studio 2013 , MVC5 , Resharper 8.2 .
Edit
I've had this behavior since two months. So I closed and reopened the project, closed and reopened Visual Studio, and have since rebooted my computer.
I wasn't worried about it because I didn't do a lot of UI ...
I'm not sure, but I think it is because I installed VS2013. I'm pretty sure it worked with VS2012.
source to share
The same bug is present in VS2017 as well. Removing the component cache seems to help. Close Visual Studio, go to folder
C: \ Users \ your.name.here \ AppData \ Local \ Microsoft \ VisualStudio \ version.goes.here \ ComponentModelCache
and delete the files in that folder. After that restart VS and it will also ask you to fix the "inconsistent line endings" as per @ Grzesiek's answer, and the component model files are recreated when VS is restarted. After that, everything should work again.
source to share