Visual studio has encountered an exception - visual-studio-2010

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 &apos;OnImportsSatisfied&apos; method on type &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword&apos;.
Resulting in: Cannot activate part &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword&apos;.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword
Resulting in: Cannot get export &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition")&apos; from part &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSKeyword&apos;.
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 &apos;OnImportsSatisfied&apos; method on type &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment&apos;.
Resulting in: Cannot activate part &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment&apos;.
Element: Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment --> Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment
Resulting in: Cannot get export &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment (ContractName="Microsoft.VisualStudio.Text.Classification.EditorFormatDefinition")&apos; from part &apos;Microsoft.VisualStudio.Web.Exports.ExportedClassificationFormatCSSComment&apos;.
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.

I had the same error and my ActivityLog.xml showed the following error:
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) No
exports were found that match the constraint:
ContractName Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator
RequiredTypeIdentity Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator
Resulting
in: Cannot set import
&apos;Microsoft.Web.Editor.Composition.ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter.Import
(ContractName="Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator")&apos;
on part
&apos;Microsoft.Web.Editor.Composition.ComponentLocator(Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.IWebLinterAggregator)+SingleImporter&apos;.
Element:
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
at
System.ComponentModel.Composition.CompositionResult.ThrowOnErrors(AtomicComposition
atomicComposition)
at
System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImportsOnce(ComposablePart
part)
at
System.ComponentModel.Composition.Hosting.CompositionContainer.SatisfyImportsOnce(ComposablePart
part)
at
Microsoft.VisualStudio.Composition.NetFxAdapters.CompositionService.SatisfyImportsOnce(ComposablePart
part)
at
System.ComponentModel.Composition.AttributedModelServices.SatisfyImportsOnce(ICompositionService
compositionService, Object attributedPart)
at
Microsoft.Web.Editor.Composition.ComponentLocator`1.Import()
at
Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.LinterUtilities.<>c.<.cctor>b__4_1()
at System.Lazy`1.CreateValue()
at
System.Lazy`1.LazyInitValue()
at
System.Lazy`1.get_Value()
at
Microsoft.VisualStudio.Web.Editor.Package.Lint.WebLinter.LinterUtilities.IsFileSupported(String
fileName)
at
Microsoft.VisualStudio.Web.Editor.Package.Lint.ErrorTagger.LintErrorTaggerProvider.CreateTagger[T](ITextBuffer
textBuffer)
at
Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.GatherTaggers(ITextBuffer
textBuffer)
Solved it by going to Tools -> Extensions and Updates -> Updates -> Visual Studio Gallery -> Installed the new version of Microsoft ASP.NET and Web Tools

(The following solution worked for me)
I just clicked on the solution file and by default it has tried to open the *.sln file in visual studio 2015 and then I have got the error message "Visual Studio has encountered an exception. This may be caused by an extension".
I had two visual studio version installed - visual studio 2015 & visual studio 2017. I opened the *.sln file in notepad and I could see VisualStudioVersion = 14.0.24720.0 which indicates the solution was created in visual studio 2015.
Then I right clicked the *.sln file and choose the vs 2017 to open it. Then it has open successfully. My best guess is one of the visual studio 2015 extension was not loading correctly and that is why I was receiving that error message.

Try this
Tools->Import and export settings->Reset all settings.

Download web essentials for your VS version. It sorted my issue regarding ActivityLog.xml.
Web Essential

Related

InspectorPackage did not load correctly

I recently installed Xamarin. I experienced no issues with it for about a week. Now, when i load visual studio I get an alert that says:
The 'InspectorPackage' package did not load correctly.
The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file
'C:\Users{redacted}\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml'.
Restarting Visual Studio could help resolve this issue.
Continue to show this error message?
Restarting Visual Studio does not resolve this issue.
Upon inspecting the xml file, I find:
<entry>
<record>503</record>
<time>2017/02/15 15:33:56.686</time>
<type>Error</type>
<source>VisualStudio</source>
<description>LegacySitePackage failed for package [InspectorPackage]Source:
&apos;&apos; Description: Not implemented
(Exception from HRESULT: 0x80004001 (E_NOTIMPL))
System.NotImplementedException: Not implemented
(Exception from HRESULT: 0x80004001 (E_NOTIMPL))
at EnvDTE.Project.get_FullName()
at Xamarin.Inspector.VS.VSAgentExecutionTarget..ctor(Project proj)
at Xamarin.Inspector.VS.VSInspectorSession.CreateAgentExecutionTarget()
at Xamarin.Interactive.IdeSupport.InspectorSession.Prepare()
at Xamarin.Inspector.VS.InspectorPackage.RefreshInspectorSession()
at Xamarin.Inspector.VS.InspectorPackage.Initialize()
at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)
</description>
<guid>{0FCBA9C6-0554-418C-8B79-FF2ED7DC658D}</guid>
<hr>80004001 - E_NOTIMPL</hr>
<errorinfo></errorinfo>
</entry>
What can I do to fix this?
This error seems to only appear when you have multiple startup projects in a solution.
I reproduced it by creating an empty solution with two empty console projects. When only one is set as startup everything works fine. However, when setting both as startup this error pops up.
I also came across this bug where the last post on 14 Jan 2017 states that the upcoming version 1.1 release will fix this issue: https://bugzilla.xamarin.com/show_bug.cgi?id=49417
You can check your version in the about box in VS. On VS2015 it is Help | About Microsoft Visual Studio and I reckon it is the Xamarin Inspector Support entry. Mine is at 1.0.0.0 so I assume I'll have to wait for the upcoming release :)
update:
Oddly enough, an update just arrived for the Xamarin Inspector (less than 30 min after answering). The first load of my test solution still popped up with the error but after that it seems fine.
update (28 Feb 2017):
I am still experiencing the issue with the following version:
Xamarin Inspector Support 1.1.2.0 (cdc01b9f4466b6dcc3095828824a12d041c9f55e)
Adds support for inspecting Xamarin and WPF apps.
This is what i did and it worked for me:
1) go to the path of Visual Studio and delete everything in that folder
(this will delete you visual studio set up ) Visual Studio wont work after this
C:\Users\<username>\AppData\Local\Microsoft\VisualStudio
2) uninstall Visual Studio. And install it again.
If this didn't work look around for xamarin files in that folder and delete everything inside.

Project does not load after installing visual studio 2013 update 2

After installing Visual Studio Professional 2013 update 2, I get the following error :
"No EditorOptionDefinition export found for the given option name:
Adornments/HighlichtCurrentLine/Enable
Parameters name: optionId"
ActivityLog contains the following error:
<entry>
<record>883</record>
<time>2014/06/13 10:10:10.411</time>
<type>Error</type>
<source>VisualStudio</source>
<description>Construction of frame content failed.
Frame identifier: ST:0:0:{0f887920-c2b6-11d2-9375-0080c747d9a0}
Frame caption: Find Results 1
Exception details:
System.ArgumentException: No EditorOptionDefinition export found for the given option name: Adornments/HighlightCurrentLine/Enable
Parameter name: optionId
at Microsoft.VisualStudio.Text.EditorOptions.Implementation.EditorOptionsFactoryService.GetOptionDefinitionOrThrow(String optionId)
at Microsoft.VisualStudio.Text.EditorOptions.Implementation.EditorOptions.SetOptionValue(String optionId, Object value)
at Microsoft.VisualStudio.Text.EditorOptions.Implementation.EditorOptions.SetOptionValue[T](EditorOptionKey`1 key, T value)
at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.SetPropertiesToToolWindowDefaults()
at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Init_SetSite(Object pUnkSite)
at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.SetSite(Object pUnkSite)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConstructContent()</description>
</entry>
A search on the internet for this problem did not yield a solution.
This question seems unrelated:
Visual Studio 2013 Crashed after Update 2?
Any help would be appreciated.
As mentioned in this link
1.Close Visual Studio
2.Open the folder: %LocalAppData%\Microsoft\VisualStudio\12.0\
3.Rename the ComponentModelCache folder
4.Restart Visual Studio.
I had also faced the same issue after I installed Visual Studio 2013 Update 3.
I’ve Visual Studio 2013 Professional edition.
As suggested on this link:
http://gerardbeckerleg.wordpress.com/2013/10/24/no-editoroptiondefinition-export-found-for-the-given-option-name/#comment-259
I installed Web Essentials 2013 for VS 2013 and the issue of not opening code files resolved.
Here is link for Web Essentials 2013:-
http://visualstudiogallery.msdn.microsoft.com/56633663-6799-41d7-9df7-0f2a504ca361
Rerunning the installation and selecting repair fixed the issue.
"No EditorOptionDefinition export found for the given option name: Adornments/HighlichtCurrentLine/Enable Parameters name: optionId"
Conrol Panel -> Programs -> Find Visual Studio -> right click -> repair
Perhaps this is not the cause of your crash, but I got a similar error twice and I have fixed it like so:
I had VisualSVN installed in VS2013. Once I've unistalled it (from Windows' "Uninstall or Change a Program") everything was OK.
Then I've re-installed it.
Seems like it was caused by newly installed addons messing up VisualSVN's setup...
(In my case VS2013 crashed during launch.)
I hope this helps somebody.

How do I remove the popup about "The 'VSTS for Database Professionals' package did not load correctly."?

I'm not sure exactly when, my VS2010 started showing me the same error popup every time I loaded it. Clicking "No" has no effect, since the message will show up again each and every time I open VS.
I really don't see any adverse effect without this "VSTS for Database Professionals", but the error popup is getting annoying. Can anyone tell me how to disable it without having to uninstall anything?
---------------------------
Microsoft Visual Studio
---------------------------
The 'VSTS for Database Professionals' package did not load correctly.
The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by running the application together with the /log parameter on the command line, and then examining the file 'C:\Users\peter.mounce\AppData\Roaming\Microsoft\VisualStudio\10.0\ActivityLog.xml'.
Continue to show this error message?
---------------------------
Yes No
---------------------------
Edited to add: I did a google search to see if anyone else had this problem, but the only cases are found are not applicable to my situation, since I have neither LightSwitch nor PostSharp installed.
I do have ReSharper 6.1, if it helps any.
Do you have .NET Framework 4.5 installed? If not, installing that can help with this popup. I have not investigated why, but this package appears to depend on .NET Framework 4.5 for some reason. Even if using Visual Studio 2010 (which does not even support 4.5).
From your log file, it appears Resharper is somehow interfering. Try uninstalling/repairing and seeing if that makes it better.
<entry>
<record>288</record>
<time>2013/04/11 18:30:06.996</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [VSTS for Database Professionals]</description>
<guid>{068E2583-0872-403B-AF4C-6C2A8F2D8C3E}</guid>
<hr>80131522</hr>
<errorinfo>Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'JetBrains.Platform.ReSharper.Util, Version=6.1.1000.82, Culture=neutral, PublicKeyToken=1010a0d8d6380325'.</errorinfo>
</entry>
Visual Studio 2010 installation media: \WCU\DAC folder, find and run-install:
DACFramework_enu.msi
DACProjectSystemSetup_enu.msi
TSqlLanguageService_enu.msi
Reapply Visual Studio 2010 SP1
Details:
http://connect.microsoft.com/VisualStudio/feedback/details/532121/tons-of-package-did-not-load-correctly-errors
The solution is to reset the settings (in case something went wrong with the SQL side of installation):
1) Launch DOS in ADMIN mode (hold WindowsKey+X), Select "Command Prompt (Admin)"
2) Go to your developer studio folder, usually it's under "C:\Program File(x86)\Microsoft Visual Studio 10.0\Common7\IDE"
3) Reset the settings by typing:
devenv.exe /ResetSettings
4) Once done, close DOS, and then launch Visual Studio, the error should disappear.

Visual Studio 2010 Cannot Resolve Moniker 877c

I created a few sequence diagrams in VS 2010 and when I try to open them in design view I get the following error:
Cannot resolve moniker '8cc714d1-d71f-4f0f-a3b5-a34b74dfb852'
I searched the Sequence Diagram XML and could not find this GUID. How do I resolve this error so I can open my diagram?
It says that there are some references which layout file cannot resolve.
For this you just need to delete .dbml.layout file.
And then just double click on .dbml file.
Just received this error in VS 2015, along with a few other very strange ones. Everything I tried, including reverting the file, had no effect. I restarted Visual Studio, did another Build, and the errors were gone.

Visual Studio 2008 Designer File Bug?

This has been driving me crazy for months. I have a multiple projects that compile without errors. If I start copying and pasting controls (or even just plain 'p' tags) the designer will fail 1/2 the time with the error "the method or operation is not implemented". The complexity of the page doesn't matter. The 'solution' is to delete the designer file, exit visual studio, open visual studio and convert the offending aspx file to a 'web application' to regenerate the designer file.
This is a really annoying. I can't find any fixes on Google. Is there a way to disable the automatic designer file? Make it so it only generates on a 'build' command and not fail everytime I'm laying out a aspx page?
Thanks
To find the fix for the issue you would need to find the cause of the issue. It might be possible to get more information on what is causing the issue if you attach a debugger to Visual Studio. This could be done by following these steps:
Open two instances of visual studio (run as administrator)
In one, open your project and get to a point right before the issue occurs
Attach the other instance of Visual Studio to the one with your project (Tools -> Attach to Process)
Perform the steps to reproduce the issue.
Note that to actually catch the exception you will need to change a few debugging options. First you would need to make sure that the Just My Code check box is unchecked in the General debugging options in Visual Studio. The second is on the exceptions dialog you will need to catch thrown exceptions. The exception dialog is under the Debug menu in Visual Studio.

Resources