Roslyn: quick actions and refactoring ArgumentNullReferenceException

Created on 30 Mar 2020  路  17Comments  路  Source: dotnet/roslyn

_This issue has been moved from a ticket on Developer Community._


When I call quick actions and refactoring for the first time, I get an ArgumentNullReferenceException and the namespace adding function no longer works. The error occurred on version 16.5.0 and 16.5.1
Last entries in ActivityLog

<entry>
    <record>3067</record>
    <time>2020/03/30 09:12:51.668</time>
    <type>Error</type>
    <source>Microsoft.VisualStudio.ComponentModelHost.VsShellComponentModelHost</source>
    <description>An invalid MEF cache has been found due to a mismatching timestamp or MVID: Microsoft.VisualStudio.ExtensibilityHosting.InvalidMEFCacheException: The Visual Studio component cache is out of date (assembly: Microsoft.CodeQuality.CSharp.Analyzers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35). Please restart Visual Studio.;VS.Platform.ExtensibilityHosting.MefCacheInvalidation.LoadedAssembly.Name=Microsoft.CodeQuality.CSharp.Analyzers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35;VS.Platform.ExtensibilityHosting.MefCacheInvalidation.LoadedAssembly.CodeBase=file:///C:/Users/LIFEf/AppData/Local/Temp/VS/AnalyzerAssemblyLoader/af398bdbd73c42d5aeb059f77ebba698/6/Microsoft.CodeQuality.CSharp.Analyzers.dll;VS.Platform.ExtensibilityHosting.MefCacheInvalidation.ActualTimestamp=637206708100000000;VS.Platform.ExtensibilityHosting.MefCacheInvalidation.ExpectedTimestamp=637090033026102134;VS.Platform.ExtensibilityHosting.MefCacheInvalidation.ActualMVID=8f2d5d8d-d636-4c79-8689-080cc192c23c;VS.Platform.ExtensibilityHosting.MefCacheInvalidation.ExpectedMVID=35e2cd95-b028-45e3-81fa-8837a703b945&#x000D;&#x000A;</description>
  </entry>
  <entry>
    <record>3068</record>
    <time>2020/03/30 09:12:51.676</time>
    <type>Error</type>
    <source>Microsoft.VisualStudio.ComponentModelHost.VsShellComponentModelHost</source>
    <description>A MEF Component threw an exception at runtime: System.ArgumentNullException: Value cannot be null.&#x000D;&#x000A;Parameter name: type&#x000D;&#x000A;   at System.Reflection.IntrospectionExtensions.GetTypeInfo(Type type)&#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()</description>
  </entry>
  <entry>
    <record>3069</record>
    <time>2020/03/30 09:12:56.780</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ArgumentNullException: Value cannot be null.&#x000D;&#x000A;Parameter name: type&#x000D;&#x000A;   at System.Reflection.IntrospectionExtensions.GetTypeInfo(Type type)&#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_0`1.&lt;As&gt;b__0()&#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.CodeAnalysis.CodeFixes.CodeFixService.&lt;&gt;c__DisplayClass31_1.&lt;GetFixerPerLanguageMap&gt;b__0()&#x000D;&#x000A;   at System.Lazy`1.CreateValue()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at System.Lazy`1.get_Value()&#x000D;&#x000A;   at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.&lt;AppendFixesAsync&gt;d__19.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.&lt;GetFixesAsync&gt;d__16.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackground[T](Task`1 task, CancellationToken cancellationToken)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetCodeFixes(ITextBufferSupportsFeatureService supportsFeatureService, ISuggestedActionCategorySet requestedActionCategories, Workspace workspace, Document document, SnapshotSpan range, Func`2 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, Func`1 call, T valueOnThrow)&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
  </entry>
System.ArgumentNullException: Value cannot be null.
Parameter name: type
   at System.Reflection.IntrospectionExtensions.GetTypeInfo(Type type)
   at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.Resolve(MethodRef methodRef)
   at Microsoft.VisualStudio.Composition.Reflection.MethodRef.Resolve()
   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.MoveToState(PartLifecycleState requiredState)
   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()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.<>c__DisplayClass31_1.<GetFixerPerLanguageMap>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.CodeAnalysis.CodeFixes.CodeFixService.<AppendFixesAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.<GetFixesAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackground[T](Task`1 task, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetCodeFixes(ITextBufferSupportsFeatureService supportsFeatureService, ISuggestedActionCategorySet requestedActionCategories, Workspace workspace, Document document, SnapshotSpan range, Func`2 addOperationScope, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetSuggestedActions(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, IUIThreadOperationContext operationContext, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetSuggestedActions(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, IUIThreadOperationContext operationContext)
   at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbSession.<>c__DisplayClass40_4.<TryGetSuggestedActionSets>b__1()
   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint[T](Object errorSource, Func`1 call, T valueOnThrow)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Original Comments

Visual Studio Feedback System on 3/30/2020, 02:35 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

Area-IDE Bug Developer Community

Most helpful comment

@JaCraig @LIFEfreedom @gh5692 Can you guys check if you have installed "Microsoft Code Analysis 2019" VSIX extension locally: https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.MicrosoftCodeAnalysis2019? If so, please uninstall this VSIX and try again.

All 17 comments

the error appears in only one solution, it seems.
Enterprise Edition is on another pc and there is no such problem

To jump on this, this is happening on every project where I've updated FxCopAnalyzers to 3.0. Rolling back to 2.9.8 fixes the issue.

This issue is an argument exception due to MEF cache corruption - this is not something that can be caused by an analyzer NuGet package. @tmat any idea how this could be happening for an analyzer assembly? I have never seen this before.

@jinujoseph @vatsalyaagrawal The issue either belongs to Roslyn repo or Platform/Extensibility team - an analyzer NuGet package cannot cause MEF cache corruption by itself.

In my instance I only have the last error, the CodeAnalysis one. I don't have any MEF issues in my log. Just this:

System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Reflection.IntrospectionExtensions.GetTypeInfo(Type type) at Microsoft.VisualStudio.Composition.Reflection.ResolverExtensions.Resolve(MethodRef methodRef) at Microsoft.VisualStudio.Composition.Reflection.MethodRef.Resolve() 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.MoveToState(PartLifecycleState requiredState) 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_01.&lt;As&gt;b__0()&#x000D;&#x000A; at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue()&#x000D;&#x000A; at System.Lazy1.get_Value() at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.<>c__DisplayClass31_1.<GetFixerPerLanguageMap>b__0() at System.Lazy1.CreateValue()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A; at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A; at System.Lazy1.get_Value() at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.<AppendFixesAsync>d__19.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.<GetFixesAsync>d__16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackgroundT at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetSuggestedActions(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, IUIThreadOperationContext operationContext, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetSuggestedActions(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, IUIThreadOperationContext operationContext) at Microsoft.VisualStudio.Language.Intellisense.Implementation.LightBulbSession.<>c__DisplayClass40_4.<TryGetSuggestedActionSets>b__1() at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPointT

That to me reads like a code analysis related thing.

I have the same issue.

<entry>
    <record>900</record>
    <time>2020/05/06 14:09:27.093</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ArgumentNullException: Value cannot be null.&#x000D;&#x000A;Parameter name: type&#x000D;&#x000A;   at System.Reflection.IntrospectionExtensions.GetTypeInfo(Type type)&#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_0`1.&lt;As&gt;b__0()&#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.CodeAnalysis.CodeFixes.CodeFixService.&lt;&gt;c__DisplayClass31_1.&lt;GetFixerPerLanguageMap&gt;b__0()&#x000D;&#x000A;   at System.Lazy`1.CreateValue()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at System.Lazy`1.get_Value()&#x000D;&#x000A;   at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.&lt;AppendFixesAsync&gt;d__19.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.&lt;GetFixesAsync&gt;d__16.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackground[T](Task`1 task, CancellationToken cancellationToken)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetCodeFixes(ITextBufferSupportsFeatureService supportsFeatureService, ISuggestedActionCategorySet requestedActionCategories, Workspace workspace, Document document, SnapshotSpan range, Func`2 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, Func`1 call, T valueOnThrow)&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
  </entry>

This happens as soon as I try and access the quick actions context menu. The MEF cache error is no longer present in my log (I ran devenv.exe /updateconfiguration to fix that error). I recently updated Microsoft.CodeAnalysis.FxCopAnalyzers NuGet package from 2.9.8 to 3.0.0, and the errors started occurring sometime after the update. This is in Visual Studio 2019 16.5.4 for a project targeting .NET Framework 4.8.

Downgrading Microsoft.CodeAnalysis.FxCopAnalyzers NuGet package from 3.0.0 to 2.9.9 seems to have fixed it for me.

It seems something has regressed in CodeFixService (Roslyn) or MEF caching for extensions (VS Platform layer) that is causing this exception when analyzer packages are upgraded. Will need further investigation to identify the regression.

Also tagging @sharwell in case he has any insights here.

@JaCraig @LIFEfreedom @gh5692 Can you guys check if you have installed "Microsoft Code Analysis 2019" VSIX extension locally: https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.MicrosoftCodeAnalysis2019? If so, please uninstall this VSIX and try again.

NOTE: The same issue was reported at https://developercommunity.visualstudio.com/content/problem/1015587/quick-actions-and-refactorings-no-longer-work-and.html, and one customer posted a solution that worked for him, which was to uninstall this VSIX. Note that we are soon planning to deprecate this extension: https://github.com/dotnet/roslyn-analyzers/issues/3314

I have already switched from community to Enterprise edition, I can鈥檛 check the performance, unfortunately (

I was able to resolve the issue by uninstalling the Visual Studio Extension Microsoft Code Analysis 2019 Thank you @mavasani !

@mavasani Thank you! Visual Studio Extension Microsoft Code Analysis 2019 was causing the problem! After uninstalling this everything working fine.

@mavasani, uninstalling _Microsoft Code Analysis 2019_ appears to have fixed the issue on my end also. Thank you.

Thanks everyone! I am going to prioritize the work of making the Microsoft CodeAnalysis 2019 Extension/VSIX as deprecated and update the docs accordingly.

Uninstalling the Visual Studio Extension Microsoft Code Analysis 2019 resolved the issue for me.

Yes, the reason is Microsoft Code Analysis 2019. For me, the error happens only if x64 platform is selected...

Thanks @mavasani, I was having the same issue this month and thought it is ReShaper causing Visual Studio ctrl + . not working.
Uninstall the Microsoft Code Analysis 2019 extension bring the popup back again.

FYI

  <entry>
    <record>2267</record>
    <time>2020/05/20 01:47:10.480</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.ArgumentNullException: Value cannot be null.&#x000D;&#x000A;Parameter name: type&#x000D;&#x000A;   at System.Reflection.IntrospectionExtensions.GetTypeInfo(Type type)&#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_0`1.&lt;As&gt;b__0()&#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.CodeAnalysis.CodeFixes.CodeFixService.&lt;&gt;c__DisplayClass31_1.&lt;GetFixerPerLanguageMap&gt;b__0()&#x000D;&#x000A;   at System.Lazy`1.CreateValue()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at System.Lazy`1.get_Value()&#x000D;&#x000A;   at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.&lt;AppendFixesAsync&gt;d__19.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.CodeFixes.CodeFixService.&lt;GetFixesAsync&gt;d__16.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Roslyn.Utilities.TaskExtensions.WaitAndGetResult_CanCallOnBackground[T](Task`1 task, CancellationToken cancellationToken)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionsSourceProvider.SuggestedActionsSource.GetCodeFixes(ITextBufferSupportsFeatureService supportsFeatureService, ISuggestedActionCategorySet requestedActionCategories, Workspace workspace, Document document, SnapshotSpan range, Func`2 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, Func`1 call, T valueOnThrow)</description>
  </entry>
Was this page helpful?
0 / 5 - 0 ratings