Bug 8638 - NRefactory Issue Provider is throwing System.IndexOutOfRangeException
Summary: NRefactory Issue Provider is throwing System.IndexOutOfRangeException
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 3.0.x
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-11-28 13:10 UTC by Stephen Shaw
Modified: 2012-11-29 02:04 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Stephen Shaw 2012-11-28 13:10:15 UTC
I had changed some formatting in a file (no code changes) and got several of these exceptions in the console.  As I was highlighting a line MD crashed.

ERROR [2012-11-28 11:04:19Z]: CodeAnalysis: Got exception in inspector 'MonoDevelop.CSharp.Refactoring.CodeIssues.NRefactoryIssueProvider'
System.IndexOutOfRangeException: Array index is out of range.
  at System.Collections.Generic.List`1+Enumerator[ICSharpCode.NRefactory.CSharp.Analysis.ControlFlowNode].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator29`2[ICSharpCode.NRefactory.CSharp.Analysis.ControlFlowNode,ICSharpCode.NRefactory.CSharp.Analysis.ControlFlowEdge].MoveNext () [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Analysis.ControlFlowGraphBuilder.AnnotateLeaveEdgesWithTryFinallyBlocks () [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Analysis.ControlFlowGraphBuilder.BuildControlFlowGraph (ICSharpCode.NRefactory.CSharp.Statement statement, System.Func`3 resolver, ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext typeResolveContext, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Analysis.ControlFlowGraphBuilder.BuildControlFlowGraph (ICSharpCode.NRefactory.CSharp.Statement statement, ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver resolver, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Analysis.ControlFlowGraphBuilder.BuildControlFlowGraph (ICSharpCode.NRefactory.CSharp.Statement statement, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.AccessToClosureIssue+GatherVisitor.CollectIssues (ICSharpCode.NRefactory.CSharp.Refactoring.Environment env, System.String variableName) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.AccessToClosureIssue+GatherVisitor.CheckVariable (IVariable variable, ICSharpCode.NRefactory.CSharp.Statement env) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.AccessToClosureIssue+GatherVisitor.VisitVariableInitializer (ICSharpCode.NRefactory.CSharp.VariableInitializer variableInitializer) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.VariableInitializer.AcceptVisitor (IAstVisitor visitor) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.GatherVisitorBase.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitVariableDeclarationStatement (ICSharpCode.NRefactory.CSharp.VariableDeclarationStatement variableDeclarationStatement) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.VariableDeclarationStatement.AcceptVisitor (IAstVisitor visitor) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.GatherVisitorBase.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitBlockStatement (ICSharpCode.NRefactory.CSharp.BlockStatement blockStatement) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.BlockStatement.AcceptVisitor (IAstVisitor visitor) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.GatherVisitorBase.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitMethodDeclaration (ICSharpCode.NRefactory.CSharp.MethodDeclaration methodDeclaration) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.MethodDeclaration.AcceptVisitor (IAstVisitor visitor) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.GatherVisitorBase.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitTypeDeclaration (ICSharpCode.NRefactory.CSharp.TypeDeclaration typeDeclaration) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.TypeDeclaration.AcceptVisitor (IAstVisitor visitor) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.GatherVisitorBase.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitNamespaceDeclaration (ICSharpCode.NRefactory.CSharp.NamespaceDeclaration namespaceDeclaration) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.NamespaceDeclaration.AcceptVisitor (IAstVisitor visitor) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.GatherVisitorBase.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitSyntaxTree (ICSharpCode.NRefactory.CSharp.SyntaxTree syntaxTree) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.SyntaxTree.AcceptVisitor (IAstVisitor visitor) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.GatherVisitorBase.GetIssues () [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.AccessToClosureIssue.GetIssues (ICSharpCode.NRefactory.CSharp.Refactoring.BaseRefactoringContext context) [0x00000] in <filename unknown>:0 
  at MonoDevelop.CSharp.Refactoring.CodeIssues.NRefactoryIssueProvider+<GetIssues>c__Iterator16.MoveNext () [0x00000] in <filename unknown>:0 
  at MonoDevelop.CodeIssues.CodeAnalysisRunner+<Check>c__AnonStorey25.<>m__3A (MonoDevelop.CodeIssues.CodeIssueProvider provider) [0x00000] in <filename unknown>:0 
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_obj (intptr,intptr) <0xffffffff>
  at (wrapper alloc) object.AllocSmall (intptr) <0xffffffff>
  at MonoDevelop.CSharp.Refactoring.CodeIssues.NameConventionRule..ctor (ICSharpCode.NRefactory.CSharp.Refactoring.NamingRule) <0x00017>
  at MonoDevelop.CSharp.Refactoring.CodeIssues.NameConventionPolicy.<NameConventionPolicy>m__64 (ICSharpCode.NRefactory.CSharp.Refactoring.NamingRule) <0x00027>
  at System.Linq.Enumerable/<CreateSelectIterator>c__Iterator27`2.MoveNext () <0x00126>
  at System.Collections.Generic.List`1.AddEnumerable (System.Collections.Generic.IEnumerable`1<T>) <0x0008f>
  at System.Collections.Generic.List`1..ctor (System.Collections.Generic.IEnumerable`1<T>) <0x000ab>
  at MonoDevelop.CSharp.Refactoring.CodeIssues.NameConventionPolicy..ctor () <0x00103>
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <0xffffffff>
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&) <0xffffffff>
  at System.Reflection.MonoCMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x0010f>
  at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x00024>
  at System.Reflection.ConstructorInfo.Invoke (object[]) <0x00042>
  at System.Activator.CreateInstance (System.Type,bool) <0x001d7>
  at System.Activator.CreateInstance (System.Type) <0x00013>
  at System.Activator.CreateInstance<T> () <0x00023>
  at MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<T> () <0x0005f>
  at MonoDevelop.Projects.Policies.PolicyContainer.GetDefaultPolicy<T> () <0x00023>
  at MonoDevelop.Projects.Policies.PolicyContainer.Get<T> () <0x00115>
  at MonoDevelop.Projects.Policies.PolicyContainer.Get<T> () <0x0014b>
  at MonoDevelop.CSharp.Refactoring.CodeActions.MDRefactoringContext..ctor (MonoDevelop.Ide.Gui.Document,ICSharpCode.NRefactory.TextLocation,System.Threading.CancellationToken) <0x00107>
  at MonoDevelop.CSharp.Refactoring.CodeActions.NRefactoryCodeActionProvider/<GetActions>c__Iterator15.MoveNext () <0x000cf>
  at System.Collections.Generic.List`1.AddEnumerable (System.Collections.Generic.IEnumerable`1<T>) <0x0008f>
  at System.Collections.Generic.List`1.AddRange (System.Collections.Generic.IEnumerable`1<T>) <0x0005b>
  at MonoDevelop.Refactoring.RefactoringService/<GetValidActions>c__AnonStoreyF.<>m__13 () <0x0027b>
  at System.Threading.Tasks.TaskActionInvoker/FuncInvoke`1.Invoke (System.Threading.Tasks.Task,object,System.Threading.Tasks.Task) <0x00039>
  at System.Threading.Tasks.Task.InnerInvoke () <0x00046>
  at System.Threading.Tasks.Task.ThreadStart () <0x00203>
  at System.Threading.Tasks.Task.Execute () <0x00013>
  at System.Threading.Tasks.TpScheduler.TaskExecuterCallback (object) <0x00033>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>
Comment 1 Mike Krüger 2012-11-29 02:04:01 UTC
Fixed.

Will be fixed in the next major release - for 3.x I would recommend turning off source analysis because it slows down monodevelop - it's more or less a 'preview'  in the next major release it'll be usable.