github / VisualStudio

GitHub Extension for Visual Studio
https://visualstudio.github.com
MIT License
2.38k stars 1.2k forks source link

Microsoft.VisualStudio.Composition.CompositionFailedException #1239

Open sijav opened 7 years ago

sijav commented 7 years ago

Hi I recently am getting this error while opening an ionic 3.6.x (angular 4.x) project with visual studio, though everything seems to be running normally with GitHub but it worthy to look at.

Here is the log from %appdata%\Microsoft\VisualStudio\14.0\ActivityLog.xml

Microsoft.VisualStudio.Composition.CompositionFailedException: This part (GitHub.InlineReviews.Services.InlineCommentPeekService) cannot be instantiated.
   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.ThrowPartNotInstantiableException()
   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportElement(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import, RuntimeExport export, Func`3 lazyFactory)
   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.GetValueForImportSite(RuntimePartLifecycleTracker importingPartTracker, RuntimeImport import)
   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.<CreateValue>b__10_0(RuntimeImport import)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.<GetExportedValueHelper>b__0()
   at Microsoft.VisualStudio.Composition.DelegateServices.<>c__DisplayClass2_0`1.<As>b__0()
   at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Lazy`1.get_Value()
   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension,TMetadata,TExtensionInstance](Object errorSource, Lazy`2 provider, Func`2 getter)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
jozefizso commented 7 years ago

I get similar error every time I open Visual Studio 2015.

ActivityLog.xml: https://gist.github.com/jozefizso/59c2038ce60598f734962ec12f7678f2

sijav commented 7 years ago

Now I'm getting this error on various random ASP.NET projects as well

jcansdale commented 7 years ago

Could you try installing the following extension: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ClearMEFComponentCache

Then go to Tools > Clean MEF Component Cache... and select Yes to continue. This will reset Visual Studio's component cache and might resolve the issue.

Please let me know if this works.

PixelEditor commented 7 years ago

@jcansdale I tried the fix but I got the same error a couple of VS restarts later. Like @sijav I'm also experiencing it with a Solution with a couple of ASP.NET Core based projects.

sijav commented 7 years ago

@jcansdale I can't tell for sure if it temporary fixed, I'm getting random error again after a while I did that fix... but it take a while before I get another random error. Although I don't close visual studio and open it often, I keep them open :D

pgmolloy commented 6 years ago

I am getting the exception with attached log. Started happening when loading a project and since latest VS release and GitHub extension update. I remove and reattach and it is fine until closing and opening again.

Microsoft.VisualStudio.Composition.CompositionFailedException: This part (GitHub.InlineReviews.Services.InlineCommentPeekService) cannot be instantiated. at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.ThrowPartNotInstantiableException() at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose() at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.<>c__DisplayClass15_0.b__0()

meaghanlewis commented 6 years ago

Hi @pgmolloy, sorry for the late reply. Don't know if you saw this, but it looks like another user was experiencing a similar problem in this issue: https://github.com/github/VisualStudio/issues/1340#issuecomment-346887360. Could you follow the steps they took and let us know if you are still getting this exception?

grokys commented 6 years ago

Hi @sijav are you still seeing this problem after the latest VS2017 update?