ICompare exception

Bars for Windows Forms Forum

Posted 12 years ago by Kasper
Version: 2.0.0091
Platform: .NET 2.0
Environment: Windows XP (32-bit)
Avatar
Hi,

One of my users told me that he got this error when using the "Show desktop" button in Windows:

ICompare (or the ICompare methods it relies upon) did not return zero when Array.Sort called x. CompareTo(x).x:
'ActiproSoftware.UIStudio.Bar.BarButtonLink' x's type: 'BarButtonLink' The ICompare: 'ActiproSoftware.UIStudio.Bar.DockableToolBarRow+a'."

I haven't experienced this my self, and he tells me that he can't reproduce it, but now you know about it, and perhaps other people have experienced it as well :)

Comments (11)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Kasper,

That should have been fixed in a recent maintenance release, build 90 to be exact. Are you sure that user has the latest UIStudio code? I suspect they have a build before 90.


Actipro Software Support

Posted 12 years ago by Kasper
Avatar
Hi,

Another user has now experienced this bug again, when clicking on the minimize button. My application is distributed with the latest UIStudio release, 2.0.91.0, and just to make sure, I made him search all over his computer for ActiproSoftware.UIStudio.Bar.Net20.dll. As expected, it was only found in one place, and the file info said that the version was 2.0.91.0. I'm pretty sure that this is still an issue, so I hope you will look into it again. The error he got was:

IComparer (or the IComparable methods it relies upon) did not return zero when Array.Sort called x. CompareTo(x). x: 'ActiproSoftware.UIStudio.Bar.BarButtonLink' x's type: 'BarButtonLink' The IComparer: 'ActiproSoftware.UIStudio.Bar.DockableToolBarRow+a'.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
That doesn't make sense. In build 90, that IComparer's start code was changed to this:
public int Compare(object x, object y) {
    if (x == y)
        return 0;

    // Pre build 90 code here
}
With that if in place there's no way that x.CompareTo(x) can not return 0. Can you add some sort of exception handling to your app that will dump all the assemblies in use? This way you can verify for sure which assembly version is being used. Something like what the unhandled exception dialog in .NET does where it lists all the assemblies in the AppDomain and their versions.

But I still don't see how the build 90+ code could throw this based on that code above. Of course if you can find a way to repro it and tell us then that is the best way to solve any problem. This particular code happens when the host is resized, and as you can see when the host form is minimized (thus causing a resize).


Actipro Software Support

Posted 12 years ago by Kasper
Avatar
My application has the ability to run scripts based on IronPython, allowing me to check this at runtime. I have tested this piece of code on my developer machine as well as on a clean VPC, with the same installer used by my customer who experienced the problem.

from System import AppDomain

assemblies = AppDomain.CurrentDomain.GetAssemblies()
for a in assemblies:
MainForm.Editor.Text += a.GetName().FullName + "\n"

That's what you're looking for, right? I get the following lines related to ActiPro:

ActiproSoftware.WinUICore.Net20, Version=1.0.91.0, Culture=neutral, PublicKeyToken=1eba893a2bc55de5

ActiproSoftware.UIStudio.Bar.Net20, Version=2.0.91.0, Culture=neutral, PublicKeyToken=be939c973e8cb8a6

ActiproSoftware.UIStudio.Dock.Net20, Version=2.0.91.0, Culture=neutral, PublicKeyToken=be939c973e8cb8a6

ActiproSoftware.SyntaxEditor.Net20, Version=4.0.253.0, Culture=neutral, PublicKeyToken=21a821480e210563

ActiproSoftware.Shared.Net20, Version=1.0.91.0, Culture=neutral, PublicKeyToken=36ff2196ab5654b9

ActiproSoftware.Wizard.Net20, Version=3.0.131.0, Culture=neutral, PublicKeyToken=d00326104f1b454d


I will get my customer to run this script later on as well, but I'm thinking that the result will be the same. Oh, and if I could reproduce this problem, you would have had a demo of it a long time ago :)
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
That certainly does look like you have the right code. I still don't understand how that exception could possibly happen with the code change I mentioned though. Please continue to try and find the repro steps. Another idea for doing that... when it happens on their machine, have them send over the layout that was used (as long as you are persisting layouts to a file). Then load that layout on your computer. That should set up the same order of dockable toolbars, which would hopefully lead to the same scenario.


Actipro Software Support

Posted 12 years ago by Kasper
Avatar
Hi,

Just to let you know, my customer executed the same script, and the result was the same - my app is using the latest assemblies on his machine as well.
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I'd like to have you test an update to the above code where we use Equals instead of ==. Perhaps that would make a difference. I'll email you with a URL to a test build.


Actipro Software Support

Posted 12 years ago by Kasper
Avatar
Hi,

Thank you for the effort, but since I can't reproduce this, and only a couple of customers have experienced it one or two times so far, it will probably be nearly impossible to test whether or not this change helps. I think that if you feel confident that at least it doesn't make things worse, you should put it in the next maintenance release and have the rest of us cross our fingers :D
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Good news, one of our customers helped us track down what I think is causing this and it will be resolved for the upcoming maintenance release.


Actipro Software Support

Posted 12 years ago by Rick - Developer, Visual Software Systems LLC
Avatar
Hi,

I received this issue today when minimizing my application to the desktop. Thought I'd provide you with the exception info so you check to see if the fix for this that is pending release would cover this scenario also.
Description:
IComparer (or the IComparable methods it relies upon) did not return zero when Array.Sort called x. CompareTo(x). x: 'ActiproSoftware.UIStudio.Bar.BarButtonLink'  x's type: 'BarButtonLink' The IComparer: 'ActiproSoftware.UIStudio.Bar.DockableToolBarRow+a'.
Source: mscorlib

Data:
No data available

Stack Trace:
   at System.Array.SorterObjectArray.QuickSort(Int32 left, Int32 right)
   at System.Array.Sort(Array keys, Array items, Int32 index, Int32 length, IComparer comparer)
   at System.Collections.ArrayList.Sort(Int32 index, Int32 count, IComparer comparer)
   at System.Collections.ArrayList.Sort(IComparer comparer)
   at ActiproSoftware.UIStudio.Bar.BarCommandLinkCollection.a(IComparer A_0)
   at ActiproSoftware.UIStudio.Bar.DockableToolBarRow.a(Boolean A_0)
   at ActiproSoftware.UIStudio.Bar.DockableToolBarRow.MeasureCore(Graphics g, Size availableSize)
   at ActiproSoftware.WinUICore.UIElement.Measure(Graphics g, Size availableSize)
   at ActiproSoftware.WinUICore.UIControl.MeasureCore(Graphics g, Size availableSize)
   at ActiproSoftware.WinUICore.UIControl.Measure(Graphics g, Size availableSize)
   at ActiproSoftware.WinUICore.UIControl.UpdateLayout()
   at ActiproSoftware.WinUICore.UIControl.Invalidate(InvalidationLevels levels, InvalidationTypes types)
   at ActiproSoftware.WinUICore.UIControl.OnLayout(LayoutEventArgs e)
   at ActiproSoftware.UIStudio.Bar.BarDockArea.OnLayout(LayoutEventArgs e)
   at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
   at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
   at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
   at System.Windows.Forms.Control.OnResize(EventArgs e)
   at ActiproSoftware.WinUICore.UIControl.OnResize(EventArgs e)
   at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
   at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
   at System.Windows.Forms.Control.UpdateBounds()
   at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at ActiproSoftware.UIStudio.Bar.BarDockArea.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Hope this is useful.

Thanks... Rick
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes the pending fix should handle the sorting issue for BarCommandLinkCollection. Thanks for the update.


Actipro Software Support

The latest build of this product (v2020.1 build 0400) was released 6 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.