8
votes

I've just rebuilt my machine with a fresh install of Visual Studio 2015. I've also installed the extensions for Web Essentials and Web Compiler but these seem to have caused a problem

Say for example, prior to installing Web Essentials and Web Compiler, if I was editing a Razor view, if the current element was formatted a couple of tabs in, and I pressed enter, the cursor would automatically tab to the correct place.

Working Example:

<ul>
    <li> <!--press enter here-->
        |<!--would put cursor here-->
    </li>
</ul>

Non Working Example:

<ul>
    <li> <!--press enter here-->
|<!--put's cursor here-->
    </li>
</ul>

This as I'm sure you can understand is quite annoying!

I'm pretty sure it's something to do with Web Essentials or Web Compiler because this wasn't a problem before-hand. In addition to this, I am getting the following error on startup:

Error

And this appears to be the culprit in ActivityLog.xml

ERROR Editor or Editor Extension

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'RazorSupportedRuntimeVersion' 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 Microsoft.VisualStudio.Utilities.PropertyCollection.AddProperty(Object key, Object property) at Microsoft.VisualStudio.Html.Package.Razor.RazorVersionDetector.Microsoft.Html.Editor.ContainedLanguage.Razor.Def.IRazorVersionDetector.GetVersion(ITextBuffer textBuffer) at Microsoft.Html.Editor.ContainedLanguage.Razor.RazorUtility.TryGetRazorVersion(ITextBuffer textBuffer, Version& razorVersion) at Microsoft.Html.Editor.ContainedLanguage.Razor.RazorErrorTagger..ctor(ITextBuffer textBuffer) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags 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 Microsoft.Html.Editor.ContainedLanguage.Common.ContainedCodeErrorTaggerProvider1.CreateTagger[T](ITextBuffer textBuffer) at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator1.GatherTaggers(ITextBuffer textBuffer)

1
Have you tried uninstalling the two extensions? Do the problems persist? Have you tried installing only one of the two? - Tamas
@Tamas-SonarSourceTeam yeah tried that - Matthew Layton
And did you still have the issues? - Tamas
@Tamas-SonarSourceTeam I did - Matthew Layton
It would be nice to know if this problem arises with only one of the products is installed. But its tedious to do full VS uninstall and install to start from a clean slate. So I guess this question boils down to how annoying this problem is to you... - Tamas

1 Answers

2
votes

This happend to me today and I fix the problem following the instructions from the accepted answer to this question: Visual Studio 2015 Broken Razor Intellisense

Here is the answer:

I solved this problem by resetting the user data

devenv.exe /resetuserdata

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