安装并修复我的 VS2015 实例后,我仍然无法让智能感知(服务器端)在我的 MVC View 中工作。 当我在 session 中第一次打开 .cshtml 文件并找到 Activitylog 文件时,我会收到消息提示提醒。 在 ActivityLog.xml 中检索到的错误消息(简短版):
System.ArgumentException: Item has already been added. Key in dictionary: 'RazorSupportedRuntimeVersion'
完整版如下:
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.ContainedCodeErrorTaggerProvider'1.CreateTagger[T](ITextBuffer textBuffer) at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator'1.GatherTaggers(ITextBuffer textBuffer)
如果有任何帮助,我有一些字体着色自定义,并安装了 Web Essentials、Bundler & Minifier 和 Web Compiler 扩展。
更新:当我打开一个现有的网络应用程序或当我从头开始创建一个全新的应用程序时,它就会发生。 还有一个 VS2013 实例安装并运行在同一台机器上。
正如您从上图中看到的,我根本没有智能感知,也没有任何类型的代码着色。
关于如何修复它的任何线索? 提前致谢。
最佳答案
这对我来说也经常发生,似乎与扩展更新有关,但我还不能归咎于任何具体问题。我能够发现的是一种侵入性较小的解决方案。
在我的例子中,删除这个目录的内容允许 IDE 恢复:
%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
编辑:我刚刚发现这个可能也很方便 - Clear MEF Component Cache (打开 VSIX 画廊)
关于c# - Visual Studio 2015 断 Razor Intellisense,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31581666/