On Collapsing Group Throwing Exception

Jan 17, 2013 at 6:37 AM


I am trying to collapse a group but it leaves me with throwing a exception.

What i am doing is i am firstly creating groups and then selecting a group by selection all vertex of that group.

I am coloring the selected vertex using System.Windows.Media.Color class

Now when i am going for collapse the group it gives me following exception


Smrf.NodeXL.Core.Vertex.TryGetValue: The value with the key "~PDColor" is of type System.Windows.Media.Color.  The expected type is System.Drawing.Color.Parameter name: key


What wrong i m doing. I am not being able to debug this exception ?

Jan 17, 2013 at 5:33 PM

It's a bug in NodeXL.  The ReservedMetadataKeys.PerColor key can have either a System.Drawing.Color or a System.Windows.Media.Color value, but there is a place in NodeXL's "collapse group" code that mistakenly checks only for a System.Drawing.Color.

This will be fixed in the next release, which will be version  In the meantime, you can work around the bug by using System.Drawing.Color values for vertex colors instead of System.Windows.Media.Color values.  You can convert a System.Windows.Media.Color to a System.Drawing.Color like this:

    System.Drawing.Color systemDrawingColor = System.Drawing.Color.FromArgb(systemWindowsMediaColor.A, systemWindowsMediaColor.R, systemWindowsMediaColor.G, systemWindowsMediaColor.B);

Thank you for reporting this.

-- Tony