I attempt to serialize a class that derived from GoNode , the error has been thrown out.
A circular reference was detected while serializing an object of type 'Logility.Encompass.NetworkMap.NetworkMapNode'.
the class code is below:
public class NetworkMapNode : GoNode { private GoText gtUpper = null; private GoIconicNode iconNode = null;<SPAN style="COLOR: blue">public</SPAN> NetworkMapNode(<SPAN style="COLOR: #2b91af">GoFigure</SPAN> figure, <SPAN style="COLOR: blue">string</SPAN> imagePhysicsName, <SPAN style="COLOR: blue">string</SPAN> upperText, <SPAN style="COLOR: blue">string</SPAN> lowerText) : <SPAN style="COLOR: blue">base</SPAN>() { gtUpper = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">GoText</SPAN>(); gtUpper.Text = upperText; gtUpper.FontSize = 10; gtUpper.Selectable = <SPAN style="COLOR: blue">false</SPAN>; gtUpper.AutoResizes = <SPAN style="COLOR: blue">false</SPAN>; gtUpper.AutoRescales = <SPAN style="COLOR: blue">true</SPAN>; gtUpper.Minimum = 10; gtUpper.Height = 15; <SPAN style="COLOR: blue">this</SPAN>.Add(gtUpper); iconNode = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">GoIconicNode</SPAN>(); iconNode.Selectable = <SPAN style="COLOR: blue">false</SPAN>; iconNode.AutoRescales = <SPAN style="COLOR: blue">true</SPAN>; <SPAN style="COLOR: blue">string</SPAN> tmpLowerText = (lowerText == <SPAN style="COLOR: blue">string</SPAN>.Empty ? <SPAN style="COLOR: blue">null</SPAN> : lowerText); <SPAN style="COLOR: blue">if</SPAN> (imagePhysicsName.Trim() != <SPAN style="COLOR: blue">string</SPAN>.Empty) { iconNode.Initialize(<SPAN style="COLOR: blue">null</SPAN>, imagePhysicsName, tmpLowerText); } <SPAN style="COLOR: blue">else</SPAN> { iconNode.Initialize(<SPAN style="COLOR: blue">null</SPAN>, <SPAN style="COLOR: blue">null</SPAN>, tmpLowerText); iconNode.Figure = figure; } <SPAN style="COLOR: blue">if</SPAN> (iconNode.Label != <SPAN style="COLOR: blue">null</SPAN>) { iconNode.Label.FontSize = 8; } <SPAN style="COLOR: blue">this</SPAN>.Add(iconNode); <SPAN style="COLOR: blue">this</SPAN>.ResizesRealtime = <SPAN style="COLOR: blue">true</SPAN>; <SPAN style="COLOR: blue">this</SPAN>.Selectable = <SPAN style="COLOR: blue">true</SPAN>; } <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: #2b91af">PointF</SPAN> NodeLocation { <SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: green">//return iconNode.Location;</SPAN> <SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: blue">this</SPAN>.Location; } <SPAN style="COLOR: blue">set</SPAN> { <SPAN style="COLOR: green">//iconNode.Location = value;</SPAN> <SPAN style="COLOR: blue">this</SPAN>.Location = <SPAN style="COLOR: blue">value</SPAN>; } } <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><summary></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> set node size</SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"></summary></SPAN> <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: #2b91af">SizeF</SPAN> NodeSize { <SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> iconNode.Size; } <SPAN style="COLOR: blue">set</SPAN> { iconNode.Size = <SPAN style="COLOR: blue">value</SPAN>; } } <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><summary></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> go select node</SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"></summary></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><param name=</SPAN><SPAN style="COLOR: gray">"sel"</SPAN><SPAN style="COLOR: gray">></param></SPAN> <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">override</SPAN> <SPAN style="COLOR: blue">void</SPAN> OnGotSelection(<SPAN style="COLOR: #2b91af">GoSelection</SPAN> sel) { <SPAN style="COLOR: blue">base</SPAN>.OnGotSelection(sel); } <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">override</SPAN> <SPAN style="COLOR: blue">bool</SPAN> CanResize() { <SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: blue">true</SPAN>; } <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><summary></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> fill node color</SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"></summary></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><param name=</SPAN><SPAN style="COLOR: gray">"color"</SPAN><SPAN style="COLOR: gray">></param></SPAN> <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">void</SPAN> FillColor(<SPAN style="COLOR: #2b91af">Color</SPAN> color) { <SPAN style="COLOR: blue">if</SPAN> (iconNode != <SPAN style="COLOR: blue">null</SPAN>&&iconNode.Shape != <SPAN style="COLOR: blue">null</SPAN>) { iconNode.Shape.BrushColor = color; } } <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: #2b91af">Dictionary</SPAN><<SPAN style="COLOR: blue">string</SPAN>, <SPAN style="COLOR: blue">string</SPAN>> MenuItems = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">Dictionary</SPAN><<SPAN style="COLOR: blue">string</SPAN>, <SPAN style="COLOR: blue">string</SPAN>>(); <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><summary></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> override get context menu</SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"></summary></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><param name=</SPAN><SPAN style="COLOR: gray">"view"</SPAN><SPAN style="COLOR: gray">></param></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><returns></returns></SPAN> <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">override</SPAN> <SPAN style="COLOR: #2b91af">GoContextMenu</SPAN> GetContextMenu(<SPAN style="COLOR: #2b91af">GoView</SPAN> view) { <SPAN style="COLOR: #2b91af">GoContextMenu</SPAN> cm = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">GoContextMenu</SPAN>(view); <SPAN style="COLOR: blue">if</SPAN> (view.CanInsertObjects()) { <SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">KeyValuePair</SPAN><<SPAN style="COLOR: blue">string</SPAN>, <SPAN style="COLOR: blue">string</SPAN>> itemData <SPAN style="COLOR: blue">in</SPAN> MenuItems) { <SPAN style="COLOR: #2b91af">GoMenuItem</SPAN> item = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">GoMenuItem</SPAN>(itemData.Key, itemData.Value); item.Click = itemData.Value; cm.MenuItems.Add(item); } } <SPAN style="COLOR: green">//this</SPAN> <SPAN style="COLOR: blue">return</SPAN> cm; } <SPAN style="COLOR: blue">private</SPAN> <SPAN style="COLOR: blue">void</SPAN> MenuClick(<SPAN style="COLOR: blue">object</SPAN> sender, <SPAN style="COLOR: #2b91af">EventArgs</SPAN> e) { <SPAN style="COLOR: blue">if</SPAN> (OnMenuClick != <SPAN style="COLOR: blue">null</SPAN>) { <SPAN style="COLOR: #2b91af">NetworkMenuEventArgs</SPAN> eventArgs = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">NetworkMenuEventArgs</SPAN>(); eventArgs.Caption = (sender <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: #2b91af">MenuItem</SPAN>).Text; OnMenuClick(<SPAN style="COLOR: blue">this</SPAN>, eventArgs); } } <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">event</SPAN> <SPAN style="COLOR: #2b91af">NetworkMenuEventHandler</SPAN> OnMenuClick; <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">override</SPAN> <SPAN style="COLOR: blue">object</SPAN> UserObject { <SPAN style="COLOR: blue">get</SPAN> { <SPAN style="COLOR: blue">return</SPAN> <SPAN style="COLOR: blue">base</SPAN>.UserObject; } <SPAN style="COLOR: blue">set</SPAN> { <SPAN style="COLOR: blue">base</SPAN>.UserObject = <SPAN style="COLOR: blue">value</SPAN>; <SPAN style="COLOR: blue">if</SPAN> (iconNode != <SPAN style="COLOR: blue">null</SPAN>) { iconNode.UserObject = <SPAN style="COLOR: blue">value</SPAN>; } } } <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><summary></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> layout children node</SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"></summary></SPAN> <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray"><param name=</SPAN><SPAN style="COLOR: gray">"childchanged"</SPAN><SPAN style="COLOR: gray">></param></SPAN> <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">override</SPAN> <SPAN style="COLOR: blue">void</SPAN> LayoutChildren(<SPAN style="COLOR: #2b91af">GoObject</SPAN> childchanged) { <SPAN style="COLOR: blue">base</SPAN>.LayoutChildren(childchanged); <SPAN style="COLOR: blue">if</SPAN> (<SPAN style="COLOR: blue">this</SPAN>.Initializing) { <SPAN style="COLOR: blue">return</SPAN>; } <SPAN style="COLOR: blue">if</SPAN> (gtUpper != <SPAN style="COLOR: blue">null</SPAN> && iconNode != <SPAN style="COLOR: blue">null</SPAN>) { gtUpper.WrappingWidth = iconNode.Width; gtUpper.Clipping = <SPAN style="COLOR: blue">true</SPAN>; gtUpper.SetSpotLocation(MiddleBottom, iconNode, MiddleTop); } } }</PRE><PRE style="FONT-FAMILY: NSimSun; : white; COLOR: black; FONT-SIZE: 13px"> </PRE><PRE style="FONT-FAMILY: NSimSun; : white; COLOR: black; FONT-SIZE: 13px">the goweb version is 4.2.0.4, IDE is vs2010,.net framework is 4, the application is asp.net .</PRE><PRE style="FONT-FAMILY: NSimSun; : white; COLOR: black; FONT-SIZE: 13px">Whether I have some errors in above code?</PRE><PRE style="FONT-FAMILY: NSimSun; : white; COLOR: black; FONT-SIZE: 13px">Thanks</PRE><PRE style="FONT-FAMILY: NSimSun; : white; COLOR: black; FONT-SIZE: 13px"> </PRE></DIV>