Ryoushin Ryoushin - 1 year ago 112
C# Question

Visual Studio 2015 Broken Razor Intellisense

After installing and then repairing my VS2015 instance I still cannot get intellisense (server side) to work in my MVC views.
I get alerted by message prompt as soon as I open for the first time in a session an .cshtml file and get addressed to the Activitylog file.
Error message retrieved in ActivityLog.xml (short version):

System.ArgumentException: Item has already been added. Key in
dictionary: 'RazorSupportedRuntimeVersion'

Here's the full version:

System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. ---> System.ArgumentException: Item
has already been added. Key in dictionary:
Key being added:
'RazorSupportedRuntimeVersion' at
System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean
add) at System.Collections.Hashtable.Add(Object key, Object value) at
System.Collections.Specialized.HybridDictionary.Add(Object key, Object
value) at
key, Object property) at
textBuffer) at
textBuffer, Version& razorVersion) at
textBuffer) --- End of inner exception stack trace --- at
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[]
arguments, Signature sig, Boolean constructor) at
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes, StackCrawlMark& stackMark) at
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes) at System.Activator.CreateInstance(Type type,
Object[] args) at
textBuffer) at

If it's any help, I have some font-coloring customizations, and have the Web Essentials, Bundler & Minifier and Web Compiler extensions installed.

UPDATE: it happens either when I open an existing web application or when I create a brand new one from scratch.
There's also an instance of VS2013 installed and running on the same machine.

No intellisense at all

As you can see from the pic above I get no intellisense at all, nor any kind of code coloring.

Any clue about how to fix it?
Thanks in advance.

Answer Source

I solved this problem by resetting the user data

devenv.exe /resetuserdata

and remove the ".vs" folder in my project.