cezarypiatek / MappingGenerator

:arrows_counterclockwise: "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator
MIT License
1.03k stars 120 forks source link

Crashing Quick Actions and Refactoring of Visual Studio 16.6 #123

Closed carlospence closed 4 years ago

carlospence commented 4 years ago

I just updated to Visual Studio 16.6 and the Quick Actions stopped working, anytime I click on the Quick Actions the error below is displayed. I have update the MappingGenerator to the latest version and still having the same issue. Whenever I disable the plugin, every works as expected.

MappingGenerator Error

cezarypiatek commented 4 years ago

Hi,

Did you try to restart VS/OS ? Please also try to clear MEF cache with this extension https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ClearMEFComponentCache

UPDATE: Cleaning Temp directory (%USERPROFILE%\AppData\Local\Temp\) could also help here.

Please let me know if that solved the issue.

mrdavidkovacs commented 4 years ago

Hi,

I have the same problem.

Things I've tried:

Nevertheless, I get to following exception: Microsoft.VisualStudio.ExtensibilityHosting.InvalidMEFCacheException: The Visual Studio component cache is out of date (assembly: MappingGenerator, Version=1.14.356.0, Culture=neutral, PublicKeyToken=null). Please restart Visual Studio.&#x000D;&#x000A; at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.&lt;&gt;c__DisplayClass17_0.&lt;LoadAssembly&gt;b__0(AssemblyName assemblyNameParam)&#x000D;&#x000A; at Microsoft.VisualStudio.ExtensibilityHosting.Utilities.SafeGetOrAdd[TKey,TValue](IDictionary2 dictionary, TKey key, Object lockObj, Func2 valueFactory)&#x000D;&#x000A; at Microsoft.VisualStudio.ExtensibilityHosting.FaultCatchingAssemblyLoader.LoadAssembly(AssemblyName assemblyName)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.GetManifest(Resolver resolver, AssemblyName assemblyName)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.TryUseFastReflection(TypeRef typeRef, Module&amp; manifest)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.Resolve(MethodRef methodRef)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.Reflection.MethodRef.Resolve()&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.&lt;&gt;c__DisplayClass15_0.&lt;GetExportedValueHelper&gt;b__0()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.&lt;&gt;c__DisplayClass15_0.&lt;GetExportedValueHelper&gt;b__0()&#x000D;&#x000A; at Microsoft.VisualStudio.Composition.DelegateServices.&lt;&gt;c__DisplayClass2_01.<As>b0() at System.Lazy1.CreateValue()&#x000D;&#x000A; at System.Lazy1.LazyInitValue() at System.Lazy`1.get_Value() at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.<>c__DisplayClass5_0.<DistributeLanguages>b0() at System.Lazy1.CreateValue()&#x000D;&#x000A; at System.Lazy1.LazyInitValue() at System.Lazy1.get_Value()&#x000D;&#x000A; at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.&lt;&gt;c.&lt;.ctor&gt;b__4_4(Lazy2 lz) at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext()&#x000D;&#x000A; at System.Linq.Buffer1..ctor(IEnumerable1 source)&#x000D;&#x000A; at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable1 items)&#x000D;&#x000A; at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource](IEnumerable1 items) at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.<>cDisplayClass4_1.<.ctor>b__3() at System.Lazy1.CreateValue()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A; at System.Lazy1.get_Value() at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetProviders(Document document) at Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.<GetRefactoringsAsync>d12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackground[T](Task1 task, CancellationToken cancellationToken)&#x000D;&#x000A; at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetRefactorings(ITextBufferSupportsFeatureService supportsFeatureService, ISuggestedActionCategorySet requestedActionCategories, Workspace workspace, Document document, Nullable1 selectionOpt, Func2 addOperationScope, CancellationToken cancellationToken)&#x000D;&#x000A; at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetSuggestedActions(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, IUIThreadOperationContext operationContext, CancellationToken cancellationToken)&#x000D;&#x000A; at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetSuggestedActions(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, IUIThreadOperationContext operationContext)&#x000D;&#x000A; at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbSession.&lt;&gt;c__DisplayClass40_4.&lt;TryGetSuggestedActionSets&gt;b__1()&#x000D;&#x000A; at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint[T](Object errorSource, Func1 call, T valueOnThrow, Predicate1 exceptionToIgnore, Predicate1 exceptionToHandle) --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)`

Funny is that the exception states that I have the version 1.14.356.0 installed. But I definitely have the version 1.16.405 installed (downloaded from the GitHub releases page).

I'm running VisualStudio 16.6.2

cezarypiatek commented 4 years ago

Thanks. I've just reported this issue to Microsoft. I will provide a link to the ticket when I get confirmation.

cezarypiatek commented 4 years ago

https://developercommunity.visualstudio.com/content/problem/1080611/the-visual-studio-component-cache-is-out-of-date-2.html

cezarypiatek commented 4 years ago

@carlospence @mrdavidkovacs is it still an issue with the latest MappingGenerator and VS 16.7.2?

mrdavidkovacs commented 4 years ago

@cezarypiatek It worked for me yesterday using the latest version of the extension and Visual Studio 16.7.2. Thank you very much.