Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange() (Read 7639 times)
Paul
YaBB Newbies
*
Offline



Posts: 17
Joined: Jan 8th, 2013
Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Feb 10th, 2014 at 5:10pm
Print Post  
I have some customers that are seeing this error when LayeredLayout.Arrange() is called:

Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. x: '', x's type: 'cbfa34fb7e2601a8fe9ded6b5a5f2bbbc', IComparer: 'A.c4fe4829022cc48f721ec592db81a6431'.

Attached is XML from one of diagrams that is causing the error.

Edit: We are using version 6.0.3
  

APSS_workflow.zip (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #1 - Feb 10th, 2014 at 5:59pm
Print Post  
What does your layout code look like?
  
Back to top
 
IP Logged
 
Paul
YaBB Newbies
*
Offline



Posts: 17
Joined: Jan 8th, 2013
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #2 - Feb 10th, 2014 at 7:41pm
Print Post  
This is all I am doing to the layout before calling Arrange():

LayeredLayout layout = new LayeredLayout();
layout.StartNode = startStep;
layout.EndNode = stopStep;
layout.EnforceLinkFlow = true;
layout.LayerDistance = 75;
layout.NodeDistance = 150;
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #3 - Feb 10th, 2014 at 8:09pm
Print Post  
That works in my test project, with the traffic light nodes assigned to start / stopStep. What's the full stack trace shown for that exception?
  
Back to top
 
IP Logged
 
Paul
YaBB Newbies
*
Offline



Posts: 17
Joined: Jan 8th, 2013
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #4 - Feb 10th, 2014 at 8:10pm
Print Post  
I was able to get around the error by setting EnforceLinkFlow to false, but when we had to upgrade to 6.0.3 to fix an out of memory issue with large diagrams we were told to enable EnforceLinkFlow.

What is the best setting to reduce the layout time and avoid any errors?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #5 - Feb 10th, 2014 at 8:20pm
Print Post  
That code works in my test project, with the traffic light nodes assigned to start / stopStep. What's the full stack trace shown for that exception?
  
Back to top
 
IP Logged
 
Paul
YaBB Newbies
*
Offline



Posts: 17
Joined: Jan 8th, 2013
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #6 - Feb 10th, 2014 at 8:50pm
Print Post  
Here is the StackTrace:

at System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) at System.Array.Sort[T](T[] array, Int32 index, Int32 length, IComparer`1 comparer) at System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer) at A.cc9c96170735309eb143e1580e0c72508.c0fbb3ca2121659f890b58a89ae53409c(Boolean ca0fe6b943c53d466737ee1913e97ccff, Int32 cd1e6f3b82e0e57cb6c3d38adcef7ed39) at A.cc9c96170735309eb143e1580e0c72508.c0fbb3ca2121659f890b58a89ae53409c() at A.cc9c96170735309eb143e1580e0c72508.ca8163ba383abcda2d3de1ba9d1e29903(c210dd93cc
f2b4d1d04f8ae675e87487a c52319c3bd0e78eaa102a3fa2daff1ce2, cec9ae34113b9d4686a0552de4bb64bc3 c8d3c5967f000d0d57c220dcc8c732458, ce08062f88d34e7a0f9a43a0577a5fcb4 cf93b19b342695a7bac81395c68261cd7) at MindFusion.Diagramming.Layout.LayeredLayout.c11331ec940f4b80205644674193186b7(Di
agram c6d288cf08ca4dd554843fd0d84cfbf6a, DiagramItemCollection c970a513ad6e4aa62c1308323d7044674) at MindFusion.Diagramming.Layout.Layout.Arrange(Diagram diagram, DiagramItemCollection items) at MindFusion.Diagramming.Layout.Layout.Arrange(Diagram diagram) at DSI.PVECommon.WorkFlow.WFDesignControl.AddWorkflowToDesigner(WorkFlowDef wf)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #7 - Feb 10th, 2014 at 9:30pm
Print Post  
What .NET version does your application run on, and does it throw the exception each time you arrange the attached diagram? The results of the comparer used by the code from that stack trace depend on LayeredLayout.StableSort value, so you might check if enabling StableSort changes anything.
  
Back to top
 
IP Logged
 
Paul
YaBB Newbies
*
Offline



Posts: 17
Joined: Jan 8th, 2013
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #8 - Feb 10th, 2014 at 11:19pm
Print Post  
The application is running on .NET 4.0, and it does throw the exception each time Arrange() is called.

I was able to set StableSort to true and leave EnforceLinkFlow enabled and not get the error.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #9 - Feb 11th, 2014 at 12:53pm
Print Post  
We still could not reproduce that (with StableSort = false), running the layout code on several test systems of ours. Does your application change anything in the diagram after loading and before calling Arrange?
  
Back to top
 
IP Logged
 
Paul
YaBB Newbies
*
Offline



Posts: 17
Joined: Jan 8th, 2013
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #10 - Feb 11th, 2014 at 2:55pm
Print Post  
The method that is calling Arrange does not load a saved diagram, it creates a new diagram, adds a list of shapes, and then creates the links between them. Once all of the links are created, Arrange is called. The XML attached to this thread was captured right before that call.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #11 - Feb 11th, 2014 at 6:20pm
Print Post  
Could you check if this test project throws the exception on your system?
https://mindfusion.eu/_samples/LayeredLayout_test.zip

Add the control's setup folder /CLR4 subfolder to Project Properties -> Reference Paths to build it.
  
Back to top
 
IP Logged
 
Paul
YaBB Newbies
*
Offline



Posts: 17
Joined: Jan 8th, 2013
Re: Certain diagrams throw an IComparer error when calling LayeredLayout.Arrange()
Reply #12 - Feb 25th, 2014 at 4:57pm
Print Post  
Sorry for the delay, for some reason I don't receive notifications from this forum.

I ran your test project and did not see the error. Our QA team had a tough time reproducing the problem as well, so environment might be a factor. In any case, the StableSort fix is working for us. Thanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint