Bug 6810 - InvalidOperationException in InitializerPath.GetParentPath
Summary: InvalidOperationException in InitializerPath.GetParentPath
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-08-31 15:01 UTC by Mikayla Hutchinson [MSFT]
Modified: 2012-09-05 01:10 UTC (History)
2 users (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 Mikayla Hutchinson [MSFT] 2012-08-31 15:01:50 UTC
ERROR [2012-08-31 15:01:21Z]: Error in context action provider Convert to initializer
System.InvalidOperationException: Cannot get the parent path of a path that does not contain any members.
  at ICSharpCode.NRefactory.CSharp.Refactoring.InitializerPath.GetParentPath () [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.StatementsToInitializerConverter.PushAssignment (ICSharpCode.NRefactory.CSharp.Expression left, ICSharpCode.NRefactory.CSharp.Expression right, ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.StatementsToInitializerConverter.TryHandleAssignmentExpression (ICSharpCode.NRefactory.CSharp.ExpressionStatement expressionStatement) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.StatementsToInitializerConverter.Convert (IList`1 originalStatements) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.StatementsToInitializerConverter.ConvertToInitializer (ICSharpCode.NRefactory.CSharp.AssignmentExpression assignmentExpression, IList`1& statements) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.ConvertToInitializerAction.HandleExpressionStatement (ICSharpCode.NRefactory.CSharp.Refactoring.RefactoringContext context, ICSharpCode.NRefactory.CSharp.ExpressionStatement expressionStatement) [0x00000] in <filename unknown>:0 
  at ICSharpCode.NRefactory.CSharp.Refactoring.ConvertToInitializerAction+<GetActions>c__Iterator58.MoveNext () [0x00000] in <filename unknown>:0 
  at MonoDevelop.CSharp.Refactoring.CodeActions.NRefactoryCodeActionProvider+<GetActions>c__Iterator15.MoveNext () [0x001c0] in /Users/michael/Mono/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/NRefactoryCodeActionProvider.cs:70 
  at System.Collections.Generic.List`1[MonoDevelop.CodeActions.CodeAction].AddEnumerable (IEnumerable`1 enumerable) [0x0001a] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-2.10.9/_build/mono-2.10.9/mcs/class/corlib/System.Collections.Generic/List.cs:126 
  at System.Collections.Generic.List`1[MonoDevelop.CodeActions.CodeAction].AddRange (IEnumerable`1 collection) [0x0002a] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-2.10.9/_build/mono-2.10.9/mcs/class/corlib/System.Collections.Generic/List.cs:141 
  at MonoDevelop.Refactoring.RefactoringService+<GetValidActions>c__AnonStoreyF.<>m__13 () [0x0007f] in /Users/michael/Mono/monodevelop/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs:202
Comment 1 Simon Lindgren 2012-09-04 11:14:28 UTC
This should be fixed in https://github.com/icsharpcode/NRefactory/pull/107.

More specifically
https://github.com/riviti/NRefactory/commit/13f67510b67c78187ac0feb3faf8a3e3f6a49fbe

Mike, feel free to merge or cherry pick :)
Comment 2 Mike Krüger 2012-09-05 01:10:31 UTC
Thanks - merged.