Bug 4115 - Generate Equality Members causes MonoDevelop to crash
Summary: Generate Equality Members causes MonoDevelop to crash
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Hardware: PC Mac OS
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
Depends on:
Reported: 2012-03-27 17:09 UTC by Alex Corrado [MSFT]
Modified: 2015-08-20 03:24 UTC (History)
1 user (show)

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

Source file to repro this bug (1.06 KB, application/octet-stream)
2012-03-27 17:09 UTC, Alex Corrado [MSFT]

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:

Description Alex Corrado [MSFT] 2012-03-27 17:09:47 UTC
Created attachment 1584 [details]
Source file to repro this bug

In MD, to reproduce:

1. Open the attached .cs file in MD.
2. Put the caret inside the class and choose Edit -> Show Code Generation Window.
3. Select "Equality members" and check both properties.
4. Hit enter

The following exception appears in the crash reporter window:

System.ArgumentException: Node is already used in another tree.
Parameter name: child
  at ICSharpCode.NRefactory.CSharp.AstNode.AddChild[Expression] (ICSharpCode.NRefactory.CSharp.Expression child, ICSharpCode.NRefactory.Role`1 role) [0x00072] in /Users/builder/data/lanes/monodevelop-mac- 
  at ICSharpCode.NRefactory.CSharp.MemberReferenceExpression..ctor (ICSharpCode.NRefactory.CSharp.Expression target, System.String memberName, IEnumerable`1 arguments) [0x00006] in /Users/builder/data/lanes/monodevelop-mac- 
  at MonoDevelop.CodeGeneration.EqualityMembersGenerator+CreateEquality+<GenerateCode>c__IteratorA.MoveNext () [0x002da] in /Users/builder/data/lanes/monodevelop-mac- 
  at MonoDevelop.CodeGeneration.AbstractGenerateAction.GenerateCode () [0x00107] in /Users/builder/data/lanes/monodevelop-mac- 
  at MonoDevelop.CodeGeneration.GenerateCodeWindow.<GenerateCodeWindow>m__3 (System.Object , System.EventArgs ) [0x0000b] in /Users/builder/data/lanes/monodevelop-mac- 
  at MonoDevelop.CodeGeneration.GenerateCodeWindow+CustomTreeView.OnSubmit (System.EventArgs e) [0x0000b] in /Users/builder/data/lanes/monodevelop-mac- 
  at MonoDevelop.CodeGeneration.GenerateCodeWindow+CustomTreeView.OnKeyPressEvent (Gdk.EventKey evnt) [0x00020] in /Users/builder/data/lanes/monodevelop-mac- 
  at Gtk.Widget.keypressevent_cb (IntPtr widget, IntPtr evnt) [0x00000] in <filename unknown>:0
Comment 1 Mike Krüger 2012-03-29 11:16:21 UTC
Fixed that one.
(In the newresolver branch)