Произошла ошибка и анализатор csharpaddimportcodefixprovider отключен

Judging from the label you were given, «CSharpAddImportCodeFixProvider», I’d guess your problem was due to Visual Studio trying to identify and/or correct a missing «using» statement at the top of your C# source code file in which you made reference to a class that needed it. The Visual Studio components that usually deal with this type of problem are Intellisense, or third-party syntax highlighting/correction plugins like JetBrains’ ReSharper.

On second thought, I’m not quite sure it’s Intellisense’s fault as opposed to the plugin ReSharper’s. That’s to be determined.

I did file a similar bug report with Microsoft. The error in my case seemed to be a result of the Intellisense not knowing how to deal with a logic error in my own code (see https://connect.microsoft.com/VisualStudio/feedback/details/3133049).

In my case, I had inadvertently placed code for a method outside its class definition, though inside its similarly named namespace. Visual Studio 2015 Update 3 complained,

‘GenerateVariableCodeFixProvider’ encountered an error and has been
disabled.

The fix was to move my method back into its corresponding class definition, but it definitely brought a Visual Studio bug up to the surface.

Specifically, Visual Studio Intellisense had seen the line of code,

    Response.Write("I did something"); 

placed in a method that was declared outside a class definition (i.e., inside a namespace, but inadvertently not inside its class). The «‘FeatureLabel’ encountered an error and has been disabled» error was then displayed in a yellow bar across the top of my editor window and an «Enable» button and an «Enable and ignore future errors» button were displayed next to it.

I believe that Intellisense (or ReSharper?) tried to automatically deal with the situation and attempted to generate a variable for the keyword, «Response», but it tripped trying to do so—which in turn caused the error that was displayed.

Judging from the label you were given, «CSharpAddImportCodeFixProvider», I’d guess your problem was due to Visual Studio trying to identify and/or correct a missing «using» statement at the top of your C# source code file in which you made reference to a class that needed it. The Visual Studio components that usually deal with this type of problem are Intellisense, or third-party syntax highlighting/correction plugins like JetBrains’ ReSharper.

On second thought, I’m not quite sure it’s Intellisense’s fault as opposed to the plugin ReSharper’s. That’s to be determined.

I did file a similar bug report with Microsoft. The error in my case seemed to be a result of the Intellisense not knowing how to deal with a logic error in my own code (see https://connect.microsoft.com/VisualStudio/feedback/details/3133049).

In my case, I had inadvertently placed code for a method outside its class definition, though inside its similarly named namespace. Visual Studio 2015 Update 3 complained,

‘GenerateVariableCodeFixProvider’ encountered an error and has been
disabled.

The fix was to move my method back into its corresponding class definition, but it definitely brought a Visual Studio bug up to the surface.

Specifically, Visual Studio Intellisense had seen the line of code,

    Response.Write("I did something"); 

placed in a method that was declared outside a class definition (i.e., inside a namespace, but inadvertently not inside its class). The «‘FeatureLabel’ encountered an error and has been disabled» error was then displayed in a yellow bar across the top of my editor window and an «Enable» button and an «Enable and ignore future errors» button were displayed next to it.

I believe that Intellisense (or ReSharper?) tried to automatically deal with the situation and attempted to generate a variable for the keyword, «Response», but it tripped trying to do so—which in turn caused the error that was displayed.

Here is the error in VS. The code compiles just fine. It seems to be intellisense related. It happens on typing characters that would trigger intellisense. Like . < ( { etc.
vserror

And them I see this in windows event log. Source is «.NET Runtime»

Application: devenv.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: System.AggregateException: One or more errors occurred. —> System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.PENamespaceSymbol.LazyInitializeNamespaces(IEnumerable1 childNamespaces)
at Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.PENamespaceSymbol.LoadAllMembers(IEnumerable1 typesByNS) at Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.PENestedNamespaceSymbol.EnsureAllMembersLoaded() at Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.PENamespaceSymbol.GetMembers() at Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol.Microsoft.CodeAnalysis.INamespaceSymbol.GetMembers() at Microsoft.CodeAnalysis.Shared.Extensions.INamespaceSymbolExtensions.<GetAllTypes>d__8.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection)
at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.GetAllSourceAndAccessibleTypesInCompilation(Compilation compilation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.d__16.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 Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.<>c__DisplayClass15_1.<b__1>d.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 Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.d__15.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 Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.d__30.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 Microsoft.CodeAnalysis.FindSymbols.Finders.AbstractMethodOrPropertyOrEventSymbolReferenceFinder1.<DetermineCascadedSymbolsAsync>d__1.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 Microsoft.CodeAnalysis.FindSymbols.Finders.PropertySymbolReferenceFinder.<DetermineCascadedSymbolsAsync>d__1.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 Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<>c__DisplayClass25_0.<<DetermineAllSymbolsCoreAsync>b__0>d.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 Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<DetermineAllSymbolsCoreAsync>d__25.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 Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<DetermineAllSymbolsAsync>d__24.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 Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<FindReferencesAsync>d__11.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 Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.<FindReferencesAsync>d__38.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 Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting.AbstractDocumentHighlightsService.<GetTagsForReferencedSymbolAsync>d__2.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 Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting.AbstractDocumentHighlightsService.<GetDocumentHighlightsAsync>d__0.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 Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting.ReferenceHighlightingViewTaggerProvider.<ProduceTagsAsync>d__12.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 Microsoft.CodeAnalysis.Editor.Tagging.AbstractAsynchronousTaggerProvider1.TagSource.d__79.MoveNext()
— End of inner exception stack trace —
—> (Inner Exception #0) System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.PENamespaceSymbol.LazyInitializeNamespaces(IEnumerable1 childNamespaces)
at Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.PENamespaceSymbol.LoadAllMembers(IEnumerable1 typesByNS) at Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.PENestedNamespaceSymbol.EnsureAllMembersLoaded() at Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE.PENamespaceSymbol.GetMembers() at Microsoft.CodeAnalysis.CSharp.Symbols.NamespaceSymbol.Microsoft.CodeAnalysis.INamespaceSymbol.GetMembers() at Microsoft.CodeAnalysis.Shared.Extensions.INamespaceSymbolExtensions.<GetAllTypes>d__8.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection)
at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.GetAllSourceAndAccessibleTypesInCompilation(Compilation compilation, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.d__16.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 Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.<>c__DisplayClass15_1.<b__1>d.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 Microsoft.CodeAnalysis.FindSymbols.DependentTypeFinder.d__15.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 Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.d__30.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 Microsoft.CodeAnalysis.FindSymbols.Finders.AbstractMethodOrPropertyOrEventSymbolReferenceFinder1.<DetermineCascadedSymbolsAsync>d__1.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 Microsoft.CodeAnalysis.FindSymbols.Finders.PropertySymbolReferenceFinder.<DetermineCascadedSymbolsAsync>d__1.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 Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<>c__DisplayClass25_0.<<DetermineAllSymbolsCoreAsync>b__0>d.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 Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<DetermineAllSymbolsCoreAsync>d__25.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 Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<DetermineAllSymbolsAsync>d__24.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 Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine.<FindReferencesAsync>d__11.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 Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.<FindReferencesAsync>d__38.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 Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting.AbstractDocumentHighlightsService.<GetTagsForReferencedSymbolAsync>d__2.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 Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting.AbstractDocumentHighlightsService.<GetDocumentHighlightsAsync>d__0.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 Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting.ReferenceHighlightingViewTaggerProvider.<ProduceTagsAsync>d__12.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 Microsoft.CodeAnalysis.Editor.Tagging.AbstractAsynchronousTaggerProvider1.TagSource.d__79.MoveNext()<—

Stack:
at System.Environment.FailFast(System.String, System.Exception)
at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action1<System.Exception>) at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception) at Roslyn.Utilities.TaskExtensions.ReportFatalErrorWorker(System.Threading.Tasks.Task, System.Object) at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke() at System.Threading.Tasks.Task.Execute() at System.Threading.Tasks.Task.ExecutionContextCallback(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef) at System.Threading.Tasks.Task.ExecuteEntry(Boolean) at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, Boolean) at System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task, Boolean) at System.Threading.Tasks.TaskContinuation.InlineIfPossibleOrElseQueue(System.Threading.Tasks.Task, Boolean) at System.Threading.Tasks.StandardTaskContinuation.Run(System.Threading.Tasks.Task, Boolean) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task.FinishStageThree() at System.Threading.Tasks.Task.FinishStageTwo() at System.Threading.Tasks.Task.Finish(Boolean) at System.Threading.Tasks.Task1[[System.Threading.Tasks.TaskExtensions+VoidResult, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object)
at System.Threading.Tasks.UnwrapPromise1[[System.Threading.Tasks.TaskExtensions+VoidResult, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetFromTask(System.Threading.Tasks.Task, Boolean) at System.Threading.Tasks.UnwrapPromise1[[System.Threading.Tasks.TaskExtensions+VoidResult, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InvokeCore(System.Threading.Tasks.Task)
at System.Threading.Tasks.UnwrapPromise1[[System.Threading.Tasks.TaskExtensions+VoidResult, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Threading.Tasks.Task) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task.FinishStageThree() at System.Threading.Tasks.Task.FinishStageTwo() at System.Threading.Tasks.Task.Finish(Boolean) at System.Threading.Tasks.Task1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception) at Microsoft.CodeAnalysis.Editor.Tagging.AbstractAsynchronousTaggerProvider1+TagSource+d__79[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting.ReferenceHighlightingViewTaggerProvider+d__12.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting.AbstractDocumentHighlightsService+d__0.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.Editor.Implementation.ReferenceHighlighting.AbstractDocumentHighlightsService+d__2.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder+d__38.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine+d__11.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine+d__24.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine+d__25.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Threading.Tasks.Task+WhenAllPromise.Invoke(System.Threading.Tasks.Task) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task.FinishStageThree() at System.Threading.Tasks.Task.FinishStageTwo() at System.Threading.Tasks.Task.Finish(Boolean) at System.Threading.Tasks.Task1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object)
at System.Threading.Tasks.UnwrapPromise1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetFromTask(System.Threading.Tasks.Task, Boolean) at System.Threading.Tasks.UnwrapPromise1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Threading.Tasks.Task)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.FindSymbols.FindReferencesSearchEngine+<>c__DisplayClass25_0+<b__0>d.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.FindSymbols.Finders.PropertySymbolReferenceFinder+d__1.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.FindSymbols.Finders.AbstractMethodOrPropertyOrEventSymbolReferenceFinder`1+d__1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)

The remainder of the message was truncated.

  • Remove From My Forums
  • Question

  • I had my PC re-imaged for me. I have Visual Studio Version 14.0.25123.00 Update 2 installed on my computer. I’m getting this error when I try to use VS intellisense to reference another project.

    CSharpAddImportCodeFixProvider encountered an error and has been disabled

    I have two projects. One of them using namespace ProjectName.Web.
    And the other project using ProjectName.Web.Controllers.
    The provider crashes when I reference ProjectName.Web.Controllers,
    I believe because it is setup as a project. This is also preventing me from building my solution because it can’t find the correct name space.

    Any idea how to fix this? 

    • Edited by

      Thursday, April 28, 2016 3:51 PM

Answers

  • Hi EugeneQilo,

    Do you reference another project in Visual Studio 2015 Update with the steps of References -> Add Reference -> Projects tab -> select your project into your current project?

    Please try create two sample project without any custom code and then reference with above steps to check whether it also has this issue.

    If the new project works fine, the problem is related to your current project. Please try with following steps to confirm which project causes this issue.

    1. Create a new default project.
    2. Reference this new project into your current project.
    3. If it also get this message, the problem is mostly related to your current project. If it works fine, please go to step 4.
    4. Use the new created project to reference the existing referenced project. If get error, the problem is caused by this referenced project.

    After confirm which project causes this problem, please move the original project files to new project one by one to confirm which file causes this issue.

    And please remove the provider to check whether the problem is related to the provider itself.

    If all steps in above get this error, please try following steps to troubleshoot Visual Studio.

    1. Run Visual Studio as administrator to make sure it has enough permission to do any operations.
    2. Run Visual Studio in
      safe mode to prevents all third-party VSPackages from loading when Visual Studio starts, thus ensuring stable execution.
    3. Close all third part software when running Visual Studio, such as antivirus.
    4. Please check the ActiveLog.xml under the path of %AppData%\Microsoft\VisualStudio\14.0. This file will log all operations when you operate Visual Studio.

    If you don’t find the ActiveLog.xml in that path, please turn on the /Log switch and re-operate again to generate operations log.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click
    HERE to participate the survey.

    • Proposed as answer by
      Weiwei Cai
      Wednesday, May 4, 2016 10:18 AM
    • Marked as answer by
      Weiwei Cai
      Friday, May 6, 2016 1:53 AM

Version Used: VS2017

Steps to Reproduce:
Not sure. Happens occasionally when editing files. A error notification appears with «‘CSharpAddImportCodeFixProvider’ encountered an error and has been disabled.» The following stack trace is offered:

System.ArgumentNullException : Value cannot be null.
Parameter name: syntaxTree
   at Microsoft.CodeAnalysis.Location.Create(SyntaxTree syntaxTree,TextSpan textSpan)
   at Microsoft.CodeAnalysis.SymbolKey.SymbolKeyReader.CreateSourceLocation(String filePath,Int32 start,Int32 length)
   at Microsoft.CodeAnalysis.SymbolKey.SymbolKeyReader.ReadLocation()
   at Microsoft.CodeAnalysis.SymbolKey.Reader`1.ReadArray[T](Func`1 readFunction)
   at Microsoft.CodeAnalysis.SymbolKey.TupleTypeSymbolKey.Resolve(SymbolKeyReader reader)
   at Microsoft.CodeAnalysis.SymbolKey.SymbolKeyReader.ReadWorker(SymbolKeyType type)
   at Microsoft.CodeAnalysis.SymbolKey.SymbolKeyReader.ReadSymbolKeyWorker(Boolean first)
   at Microsoft.CodeAnalysis.SymbolKey.SymbolKeyReader.ReadSymbolKey()
   at Microsoft.CodeAnalysis.SymbolKey.Reader`1.ReadArray[T](Func`1 readFunction)
   at Microsoft.CodeAnalysis.SymbolKey.MethodSymbolKey.Resolve(SymbolKeyReader reader,Boolean isPartialMethodImplementationPart,IMethodSymbol method)
   at Microsoft.CodeAnalysis.SymbolKey.MethodSymbolKey.Resolve(SymbolKeyReader reader,String metadataName,Int32 arity,Boolean isPartialMethodImplementationPart,ImmutableArray`1 parameterRefKinds,Int32 beforeParametersPosition,IMethodSymbol method)
   at Microsoft.CodeAnalysis.SymbolKey.MethodSymbolKey.Resolve(SymbolKeyReader reader,String metadataName,Int32 arity,Boolean isPartialMethodImplementationPart,ImmutableArray`1 parameterRefKinds,Int32 beforeParametersPosition,INamedTypeSymbol namedType)
   at Microsoft.CodeAnalysis.SymbolKey.MethodSymbolKey.Resolve(SymbolKeyReader reader)
   at Microsoft.CodeAnalysis.SymbolKey.SymbolKeyReader.ReadWorker(SymbolKeyType type)
   at Microsoft.CodeAnalysis.SymbolKey.SymbolKeyReader.ReadSymbolKeyWorker(Boolean first)
   at Microsoft.CodeAnalysis.SymbolKey.Resolve(String symbolKey,Compilation compilation,Boolean ignoreAssemblyKey,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.<>c__DisplayClass21_0.<GetUnfilteredSymbolsAsync>b__0(ISymbol s)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at System.Collections.Immutable.ImmutableArray.CreateRange[T](IEnumerable`1 items)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[TSource](IEnumerable`1 items)
   at async Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.GetUnfilteredSymbolsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.AddDeclarationsAsync(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindDeclarationsAsyncImpl(<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeFixes.AddImport.AbstractAddImportCodeFixProvider`1.SearchScope.FindDeclarationsAsync[TSimpleNameSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeFixes.AddImport.AbstractAddImportCodeFixProvider`1.SymbolReferenceFinder.GetNamespacesForMatchingExtensionMethodsAsync[TSimpleNameSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeFixes.AddImport.AbstractAddImportCodeFixProvider`1.SymbolReferenceFinder.DoAsync[TSimpleNameSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeFixes.AddImport.AbstractAddImportCodeFixProvider`1.FindResultsInAllSymbolsInStartingProjectAsync[TSimpleNameSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeFixes.AddImport.AbstractAddImportCodeFixProvider`1.FindResultsAsync[TSimpleNameSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeFixes.AddImport.AbstractAddImportCodeFixProvider`1.FindResultsAsync[TSimpleNameSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.CodeFixes.AddImport.AbstractAddImportCodeFixProvider`1.RegisterCodeFixesAsync[TSimpleNameSyntax](<Unknown Parameters>)
   at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformActionAsync(<Unknown Parameters>)
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Further, selecting the enable and ignore future erros button doesn’t work as expected as this error continues to appear.

Expected Behavior:
Ideally the fix provider shouldn’t error. But when it does, the request to «ignore future errors» should be respected.

Actual Behavior:
«Endless» yellow error bars appear in the editor window, despite selecting «Enable and ignore future errors»

Понравилась статья? Поделить с друзьями:
  • Произошла ошибка значение капчи неверно
  • Произошла ошибка запросите код еще раз рамблер
  • Произошла ошибка загрузки ресурсов либо ошибка сети genshin
  • Произошла ошибка загрузки ресурсов genshin impact
  • Произошла ошибка загрузки данных возможно не вся информация