'CSharpRemoveUnusedValuesCodeFixProvider' encountered an error and has been disabled.
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
**Version Used**:
Microsoft Visual Studio Enterprise 2022 (64-bit) - Int Preview
Version 17.12.0 Preview 2.0 [35228.322.main]
**Steps to Reproduce**:
1. Clone https://github.com/dotnet/aspire
2. Launch VS using startvs.cmd
3. Start moving around the code base and wait for error to occur.
A minimal repro, with source-code provided, is ideal. Using [sharplab](https://sharplab.io/) is preferred for compiler/language issues whenever possible.
**Diagnostic Id**: CSharpRemoveUnusedValuesCodeFixProvider
If this is a report about a bug in an analyzer, please include the diagnostic ID and message if possible (e.g. `"IDE0030: Use coalesce expression"`).
**Expected Behavior**:
No yellow bars.
**Actual Behavior**:

Getting an exception in VS (this is one of many that I get, starting to file issues that I'm having):
System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeAssembly.get_DefinedTypes()
at System.Composition.Hosting.ContainerConfiguration.<>c.b__16_0(Assembly a)
at System.Linq.Enumerable.d__17`2.MoveNext()
at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor(IEnumerable`1 types,AttributedModelProvider attributeContext)
at System.Composition.Hosting.ContainerConfiguration.CreateContainer()
at Microsoft.CodeAnalysis.Host.CodeStyleHostLanguageServices.MefHostExportProvider.Create(String languageName)
at System.Runtime.CompilerServices.ConditionalWeakTable`2.GetValue(TKey key,CreateValueCallback createValueCallback)
at Microsoft.CodeAnalysis.Host.CodeStyleHostLanguageServices..ctor(HostLanguageServices hostLanguageServices)
at Microsoft.CodeAnalysis.Host.CodeStyleHostLanguageServices.Create(HostLanguageServices hostLanguageServices)
at System.Runtime.CompilerServices.ConditionalWeakTable`2.GetValue(TKey key,CreateValueCallback createValueCallback)
at Microsoft.CodeAnalysis.Shared.Extensions.ProjectExtensions.GetExtendedLanguageServices(Project project)
at Microsoft.CodeAnalysis.RemoveUnusedParametersAndValues.AbstractRemoveUnusedValuesCodeFixProvider`11.IsForEachIterationVariableDiagnostic(Diagnostic diagnostic,Document document,CancellationToken cancellationToken)
at async Microsoft.CodeAnalysis.RemoveUnusedParametersAndValues.AbstractRemoveUnusedValuesCodeFixProvider`11.RegisterCodeFixesAsync[TExpressionSyntax,TStatementSyntax,TBlockSyntax,TExpressionStatementSyntax,TLocalDeclarationStatementSyntax,TVariableDeclaratorSyntax,TForEachStatementSyntax,TSwitchCaseBlockSyntax,TSwitchCaseLabelOrClauseSyntax,TCatchStatementSyntax,TCatchBlockSyntax]()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.CodeFixes.CodeFixService.GetCodeFixesAsync()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T]()
Contributor guide
Assessment
This issue has not been assessed yet.