8

所以,我使用的是 Visual Studio 2010,在过去一周或我收到来自 Visual Studio 的消息:“Visual Studio 遇到异常。这可能是由扩展引起的。”

我的 ActivityLog.xml 将日志显示为问题:

<entry>
    <record>321</record>
    <time>2012/09/20 16:52:36.126</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below. 
Review the CompositionException.Errors property for more detailed information.&#x000D;&#x000A;&#x000D;&#x000A;1) Object reference not set to an instance of an object.&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: An exception occurred while calling the &apos;OnImportsSatisfied&apos; method on type &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword&apos;.&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot activate part &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword&apos;.&#x000D;&#x000A;Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword --&gt;  Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot get export &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword (ContractName=&quot;Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition&quot;)&apos; from part &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword&apos;.&#x000D;&#x000A;Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword (ContractName=&quot;Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition&quot;) --&gt;  Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword&#x000D;&#x000A;&#x000D;&#x000A;   at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)&#x000D;&#x000A;   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(ComposablePart part, ExportDefinition export, Boolean isSharedPart)&#x000D;&#x000A;   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()&#x000D;&#x000A;   at System.ComponentModel.Composition.Primitives.Export.get_Value()&#x000D;&#x000A;   at System.ComponentModel.Composition.ExportServices.GetExportedValueFromLazy[T](Export export)&#x000D;&#x000A;   at System.ComponentModel.Composition.ExportServices.&lt;&gt;c__DisplayClass4`2.&lt;CreateStronglyTypedExportOfTM&gt;b__1()&#x000D;&#x000A;   at System.Lazy`1.CreateValue()&#x000D;&#x000A;   at System.Lazy`1.LazyInitValue()&#x000D;&#x000A;   at System.Lazy`1.get_Value()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension](Object errorSource, Lazy`1 provider)</description>
</entry>

<entry>
    <record>322</record>
    <time>2012/09/20 16:52:36.202</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.&#x000D;&#x000A;&#x000D;&#x000A;1) Object reference not set to an instance of an object.&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: An exception occurred while calling the &apos;OnImportsSatisfied&apos; method on type &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment&apos;.&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot activate part &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment&apos;.&#x000D;&#x000A;Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment --&gt;  Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment&#x000D;&#x000A;&#x000D;&#x000A;Resulting in: Cannot get export &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment (ContractName=&quot;Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition&quot;)&apos; from part &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment&apos;.&#x000D;&#x000A;Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment (ContractName=&quot;Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition&quot;) --&gt;  Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment&#x000D;&#x000A;&#x000D;&#x000A;   at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)&#x000D;&#x000A;   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(ComposablePart part, ExportDefinition export, Boolean isSharedPart)&#x000D;&#x000A;   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()&#x000D;&#x000A;   at System.ComponentModel.Composition.Primitives.Export.get_Value()&#x000D;&#x000A;   at System.ComponentModel.Composition.ExportServices.GetExportedValueFromLazy[T](Export export)&#x000D;&#x000A;   at System.ComponentModel.Composition.ExportServices.&lt;&gt;c__DisplayClass4`2.&lt;CreateStronglyTypedExportOfTM&gt;b__1()&#x000D;&#x000A;   at System.Lazy`1.CreateValue()&#x000D;&#x000A;   at System.Lazy`1.LazyInitValue()&#x000D;&#x000A;   at System.Lazy`1.get_Value()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension](Object errorSource, Lazy`1 provider)</description>
</entry>

似乎没有任何特定的行为导致这种情况,有时会在我第一次启动 VS 时发生,有时会在我离开办公桌一段时间后再回来时发生。此外,从日志来看,它似乎是在加载 Visual Studio CSS 编辑包之后立即发生的。我安装了 MVC4,也许是新 CSS 的问题(我认为是 CSS3?)

无论如何,只是想知道是否有人以前遇到过这种情况并有某种解决方案。

4

6 回答 6

6

似乎某些 VS 扩展可能导致它崩溃。(您最近是否安装了扩展程序?)

尝试在安全模式下运行 VS 来诊断问题。

运行此命令并检查 VS 是否启动

devenv.exe /safemode

更多在这里

http://blog.meidianto.com/2010/05/16/vs2010-tips-8-got-annoying-visual-studio-2010-error-try-to-run-in-safe-mode/

于 2012-09-20T17:10:19.143 回答
4

VS 需要管理员权限来处理插件。所以右键单击VS并单击“以管理员身份运行”。它为我解决了。试一次。

于 2014-02-10T06:14:01.597 回答
0

我有同样的错误,我ActivityLog.xml显示以下错误:

System.ComponentModel.Composition.CompositionException:合成产生单个合成错误。下面提供了根本原因。查看 CompositionException.Errors 属性以获取更多详细信息。1)未找到与约束匹配的导出:ContractName Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator RequiredTypeIdentity Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator 导致:无法设置导入' Microsoft.Web.Editor.Composition.ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter.Import (ContractName="Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator" )'在部分'Microsoft.Web.Editor.Composition。ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter'。元素:Microsoft.Web.Editor.Composition.ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter.Import (ContractName="Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter. IWebLinterAggregator") --> Microsoft.Web.Editor.Composition.ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter 在 System.ComponentModel.Composition.CompositionResult.ThrowOnErrors(AtomicComposition atomicComposition) 在 System System.ComponentModel.Composition.Hosting.CompositionContainer 处的 .ComponentModel.Composition.Hosting.ImportEngine.SatisfyImportsOnce(ComposablePart 部分)。

通过转到工具 -> 扩展和更新 -> 更新 -> Visual Studio 库 -> 安装新版本来解决它Microsoft ASP.NET and Web Tools

于 2017-01-24T07:37:42.977 回答
0

(以下解决方案对我有用)

我只是单击了解决方案文件,默认情况下它试图在 Visual Studio 2015 中打开 *.sln 文件,然后我收到错误消息“Visual Studio 遇到异常。这可能是由扩展引起的”。

我安装了两个 Visual Studio 版本 - Visual Studio 2015 和 Visual Studio 2017。我在记事本中打开 *.sln 文件,我可以看到 VisualStudioVersion = 14.0.24720.0,这表明解决方案是在 Visual Studio 2015 中创建的。

然后我右键单击 *.sln 文件并选择 vs 2017 打开它。然后就成功打开了。我最好的猜测是 Visual Studio 2015 扩展之一没有正确加载,这就是我收到该错误消息的原因。

于 2018-11-07T17:45:35.040 回答
-1

试试这个工具->导入和导出设置->重置所有设置。

于 2016-04-21T11:26:53.643 回答
-2

为您的 VS 版本下载 Web Essentials。它对我关于 ActivityLog.xml 的问题进行了排序。 网络必备

于 2016-11-27T07:31:48.430 回答