Bug 14089 - Error from "create constructor"
Summary: Error from "create constructor"
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Mac OS
: High normal
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-08-19 16:16 UTC by Mikayla Hutchinson [MSFT]
Modified: 2014-01-21 07:29 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:
VERIFIED FIXED

Description Mikayla Hutchinson [MSFT] 2013-08-19 16:16:51 UTC
When using the "Create Constructor" action to create a ctor in a different file, the following error was thrown:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Could not find a resolver state for any parent of the specified node. Are you trying to resolve a node that is not a descendant of the CSharpAstResolver's root node?
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.GetPreviouslyScannedContext (ICSharpCode.NRefactory.CSharp.AstNode node, ICSharpCode.NRefactory.CSharp.AstNode& parent) [0x0005a] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:478 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.GetResolveResult (ICSharpCode.NRefactory.CSharp.AstNode node) [0x0005a] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:451 
  at ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver.Resolve (ICSharpCode.NRefactory.CSharp.AstNode node, CancellationToken cancellationToken) [0x00054] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Resolver/CSharpAstResolver.cs:167 
  at ICSharpCode.NRefactory.CSharp.Refactoring.BaseRefactoringContext.Resolve (ICSharpCode.NRefactory.CSharp.AstNode node) [0x0000e] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Refactoring/BaseRefactoringContext.cs:106 
  at ICSharpCode.NRefactory.CSharp.Refactoring.CreateMethodDeclarationAction+<GenerateParameters>c__Iterator4B.MoveNext () [0x000d1] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateMethodDeclarationAction.cs:248 
  at System.Collections.Generic.List`1[ICSharpCode.NRefactory.CSharp.ParameterDeclaration].AddEnumerable (IEnumerable`1 enumerable) [0x00013] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/corlib/System.Collections.Generic/List.cs:134 
  at System.Collections.Generic.List`1[ICSharpCode.NRefactory.CSharp.ParameterDeclaration]..ctor (IEnumerable`1 collection) [0x0002f] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/corlib/System.Collections.Generic/List.cs:69 
  at System.Linq.Enumerable.ToList[ParameterDeclaration] (IEnumerable`1 source) [0x00006] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/System.Core/System.Linq/Enumerable.cs:2951 
  at ICSharpCode.NRefactory.CSharp.AstNodeCollection`1[ICSharpCode.NRefactory.CSharp.ParameterDeclaration].AddRange (IEnumerable`1 nodes) [0x0000a] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/AstNodeCollection.cs:72 
  at ICSharpCode.NRefactory.CSharp.Refactoring.CreateConstructorDeclarationAction+<GetActions>c__Iterator4F+<GetActions>c__AnonStorey150.<>m__28B (ICSharpCode.NRefactory.CSharp.Refactoring.Script s, ICSharpCode.NRefactory.CSharp.Refactoring.RefactoringContext c) [0x00071] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateConstructorDeclarationAction.cs:57 
  at ICSharpCode.NRefactory.CSharp.Refactoring.Script+<InsertWithCursor>c__AnonStoreyD0.<>m__BC (ICSharpCode.NRefactory.CSharp.Refactoring.Script s, ICSharpCode.NRefactory.CSharp.Refactoring.RefactoringContext ctx) [0x00011] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs:413 
  at MonoDevelop.CSharp.Refactoring.CodeActions.MDRefactoringScript+<InsertWithCursor>c__AnonStorey4A.<>m__6D () [0x000e1] in /Users/michael/Mono/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringScript.cs:179 
  at Mono.TextEditor.TextDocument.RunWhenLoaded (System.Action action) [0x0000e] in /Users/michael/Mono/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/TextDocument.cs:1715 
  at MonoDevelop.Ide.Gui.Document.RunWhenLoaded (System.Action action) [0x0002c] in /Users/michael/Mono/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs:708 
  at MonoDevelop.CSharp.Refactoring.CodeActions.MDRefactoringScript.InsertWithCursor (System.String operation, ITypeDefinition parentType, System.Func`3 nodeCallback) [0x000a7] in /Users/michael/Mono/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/MDRefactoringScript.cs:166 
  at ICSharpCode.NRefactory.CSharp.Refactoring.Script.InsertWithCursor (System.String operation, ITypeDefinition parentType, System.Func`3 nodeCallback) [0x0001d] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Refactoring/Script.cs:412 
  at ICSharpCode.NRefactory.CSharp.Refactoring.CreateConstructorDeclarationAction+<GetActions>c__Iterator4F+<GetActions>c__AnonStorey150.<>m__28A (ICSharpCode.NRefactory.CSharp.Refactoring.Script script) [0x0002e] in /Users/michael/Mono/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateConstructorDeclarationAction.cs:46 
  at MonoDevelop.CSharp.Refactoring.CodeActions.NRefactoryCodeAction.Run (System.Object context, System.Object script) [0x00012] in /Users/michael/Mono/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring.CodeActions/NRefactoryCodeAction.cs:53 
  at MonoDevelop.Refactoring.RefactoringService.ApplyFix (MonoDevelop.CodeActions.CodeAction action, System.Object context) [0x0001d] in /Users/michael/Mono/monodevelop/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs:277 
  at MonoDevelop.CodeActions.CodeActionWidget+ContextActionRunner.Run (System.Object sender, System.EventArgs e) [0x00029] in /Users/michael/Mono/monodevelop/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionWidget.cs:390 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/corlib/System.Reflection/MonoMethod.cs:230 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00069] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/corlib/System.Reflection/MonoMethod.cs:238 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/corlib/System.Reflection/MethodBase.cs:114 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000d5] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/corlib/System/Delegate.cs:424 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/corlib/System/MulticastDelegate.cs:72 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x0000b] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/corlib/System/MulticastDelegate.cs:70 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/mono-None/mcs/class/corlib/System/Delegate.cs:398 
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00050] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/gtk-sharp-2-12-branch/glib/Signal.cs:195 
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00011] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/gtk-sharp-2-12-branch/glib/SignalClosure.cs:118 
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x0007d] in /Users/michael/Mono/bockbuild/profiles/monodevelop-mac-dev/build-root/gtk-sharp-2-12-branch/glib/SignalClosure.cs:146
Comment 1 Mike Krüger 2013-08-20 02:22:39 UTC
fixed
Comment 2 Sadik Ali 2014-01-21 06:31:05 UTC
I am unable to reproduce this.

Please give me some light on "'Create Constructor' action to create a ctor in a different file" 
Is this is related to creating constructor ? or some other type scenario.
Comment 3 Mike Krüger 2014-01-21 06:39:20 UTC
it's related to the create constructor action - just make a new class and type new Foo(5) - you'll get a create constructor action at that expression.

(in case the constructor doesn't exist)
Comment 4 Sadik Ali 2014-01-21 07:05:39 UTC
I have checked this and not getting issue.

Refer screen cast: http://screencast.com/t/HvNxmyj3q

Let me know I am missing any thing.

Checked With: 
All Mac
XS 4.2.3 (Build 146)
X iOS 7.0.7.58
XA 4.10.2
Comment 5 Mike Krüger 2014-01-21 07:24:55 UTC
y that was the case -> seems it's fixed
Comment 6 Sadik Ali 2014-01-21 07:29:27 UTC
As per comment 4 and 5 marking this as verified