So, I'm using Visual Studio 2010, and in the past week or I'm getting a message from Visual Studio coming up: "Visual Studio has encountered an exception. This may be caused by an extension."
My ActivityLog.xml reveals logs this as the problem:
<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.

1) Object reference not set to an instance of an object.

Resulting in: An exception occurred while calling the 'OnImportsSatisfied' method on type 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword'.

Resulting in: Cannot activate part 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword'.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword

Resulting in: Cannot get export 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition")' from part 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword'.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition") --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword

 at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
 at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(ComposablePart part, ExportDefinition export, Boolean isSharedPart)
 at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
 at System.ComponentModel.Composition.Primitives.Export.get_Value()
 at System.ComponentModel.Composition.ExportServices.GetExportedValueFromLazy[T](Export export)
 at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedExportOfTM>b__1()
 at System.Lazy`1.CreateValue()
 at System.Lazy`1.LazyInitValue()
 at System.Lazy`1.get_Value()
 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.

1) Object reference not set to an instance of an object.

Resulting in: An exception occurred while calling the 'OnImportsSatisfied' method on type 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment'.

Resulting in: Cannot activate part 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment'.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment

Resulting in: Cannot get export 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition")' from part 'Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment'.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition") --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment

 at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
 at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(ComposablePart part, ExportDefinition export, Boolean isSharedPart)
 at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
 at System.ComponentModel.Composition.Primitives.Export.get_Value()
 at System.ComponentModel.Composition.ExportServices.GetExportedValueFromLazy[T](Export export)
 at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedExportOfTM>b__1()
 at System.Lazy`1.CreateValue()
 at System.Lazy`1.LazyInitValue()
 at System.Lazy`1.get_Value()
 at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension](Object errorSource, Lazy`1 provider)</description>
</entry>
There doesn't seem to be any specific action that causes this, sometimes it happens when I first fire up VS, sometimes after I leave my desk for awhile and come back. Also, from the log, it appears to happen right after loading the Visual Studio CSS Editing Package. I have MVC4 installed, maybe it's a problem with the new CSS (CSS3 I think?)
Anyways, just wondering if anybody had run into this before and had some sort of resolution.
seems some VS extension may be causing it to crash. (did you install extension any recently?)
try running VS in safe mode to diagnose the problem.
Run this command and check if VS starts
devenv.exe /safemode
More here
http://blog.meidianto.com/2010/05/16/vs2010-tips-8-got-annoying-visual-studio-2010-error-try-to-run-in-safe-mode/
VS needs Administrator previleges to handle the plugin. So right click VS and click "RUN AS ADMINISTRATOR". It solved for me. Try once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With