Visual Studio 2019 Index was outside the bounds of the array.

anhua cai 1 Reputation point
2021-07-31T23:13:06.657+00:00

119611-image.png

System.IndexOutOfRangeException : Index was outside the bounds of the array.
at System.Collections.Generic.Dictionary2.Insert(TKey key,TValue value,Boolean add) at Microsoft.CodeAnalysis.CSharp.Symbols.Retargeting.RetargetingModuleSymbol.SetReferences(ModuleReferences1 moduleReferences,SourceAssemblySymbol originatingSourceAssemblyDebugOnly)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.SetupReferencesForRetargetingAssembly(BoundInputAssembly[] bindingResult,BoundInputAssembly& currentBindingResult,Dictionary2& missingAssemblies,SourceAssemblySymbol sourceAssemblyDebugOnly) at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.InitializeNewSymbols(List1 newSymbols,SourceAssemblySymbol sourceAssembly,ImmutableArray1 assemblies,BoundInputAssembly[] bindingResult,Dictionary2 missingAssemblies)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateAndSetSourceAssemblyFullBind(CSharpCompilation compilation)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateSourceAssemblyForCompilation(CSharpCompilation compilation)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.get_CommonAssembly()
at Microsoft.CodeAnalysis.SolutionState.UnrootedSymbolSet.Create(Compilation compilation)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.FinalState.Create(ValueSource1 finalCompilationSource,ValueSource1 compilationWithoutGeneratedFilesSource,Compilation compilationWithoutGeneratedFiles,Boolean hasSuccessfullyLoaded,TextDocumentStates1 generatedDocuments,Compilation finalCompilation,ProjectId projectId,Dictionary2 metadataReferenceToProjectId)
at async Microsoft.CodeAnalysis.SolutionState.CompilationTracker.FinalizeCompilationAsync(<Unknown Parameters>)
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
at async Microsoft.CodeAnalysis.SolutionState.CompilationTracker.GetOrBuildCompilationInfoAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.SolutionState.CompilationTracker.GetCompilationSlowAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Document.GetSemanticModelAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Shared.Extensions.DocumentExtensions.GetRequiredSemanticModelAsync(<Unknown Parameters>)
at System.Threading.Tasks.ValueTask`1.get_Result()
at async Microsoft.CodeAnalysis.CSharp.ImplementInterface.AbstractChangeImplementionCodeRefactoringProvider.ComputeRefactoringsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringService.GetRefactoringFromProviderAsync(<Unknown Parameters>)

I want to know if there is any method to avoid this alert, when I open a file in the visual studio, there always popup some error message ,tell me that Index was outside the bounds of the array.What should I do to solve this problem. Is any good ideas?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,685 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Viorel 112.9K Reputation points
    2021-08-01T05:49:26.31+00:00

    Probably you can press the “Enable and ignore future errors” button.

    You can also report this issue using HELP menu, Send Feedback, Report a Problem. This seems to be an issue of Visual Studio.

    0 comments No comments

  2. PengGe-MSFT 3,336 Reputation points
    2021-08-02T06:18:52.093+00:00

    Hi, @anhua cai

    Welcome to Microsoft Q&A!

    I cannot reproduce your issue.

    You can try to repair Visual Studio, use devenv.exe /safemode command to start Visual Studio.

    If the problem persists, I suggest you directly suggest this feature to Visual Studio Product Team in our Developer Community, and if you do suggest this feature, please share the link here, other forum members, who are interested or needed this feature will go to vote for this thread.

    Sincerely,
    Peng
    *
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread

    0 comments No comments