Node.LinksConnected link not in model

Somehow one of our users has created a diagram where we have a node that is showing 3 links connected in the data, but only has 2 links connected (visibly) in the diagram. It appears that somehow one of the links was removed from the diagram, but remains in the Node.LinksConnected. Any ideas how this could have happened?

This kind of ties in with an overall problem we are having, where if an error occurs the error isn’t being rolled back and the problem causes further errors. I’ve checked through the log of the user who created the diagram with the above error, and there are no error entries for the link being removed from the model, and the problem only crops up when moving the node afterwards. Any suggestions for how to best record user actions and rollback to the actual cause of an error?


That’s odd. What kind of model are you using? Are you able to check that there really are three links to that node data in the model? How do you know that there really are only two Link parts in the Diagram connecting to that Node? If you are able to reproduce the problem, it would be good to see if PartManager.FindLinkForData really returns only two Links.

Is there any way for you to check that the missing Link isn’t not Part.Visible? Or that it’s completely transparent or precisely (occluded) behind one of the other two Links?

Also, what kind of error are you encountering where you might not be performing a rollback instead of a commit?

The model is GraphLinksModel<GraphLinksModelNodeData, String, String, LinkData>

I’ve done some more testing, and it seems that the missing link is somehow involved with a messed up transaction… After loading the diagram that contains the link that is missing, if I complete a transaction (move a node, draw a link, etc) the link that is missing suddenly appears. I checked the PartManager.FindLinkForData for each of the LinksConnected in the node, and they are actually all found… the problem is that 1 of them isn’t being drawn, so it doesn’t contain any points (until another transaction completes).

I’m guessing this partial link may have been caused by an error either during adding/deleting of the link, where only part of the changes were updated to the model… Not sure if that’s possible, or would make sense?

The error that I am seeing is related to there not being any points in the route… We have added code to make nodes jump to snap connected nodes straight, so when the link doesn’t have any points we are seeing an error.

OK, so if I understand you correctly, in your Diagram there is indeed a Link for each link data in your GraphLinksModel.

So there are several reasons/circumstances that might cause a Link.Route not to have any points.

Is the Link.Visible? Is the Link.VisualElement.Visibility == Visibility.Visible?

Is the Link.FromNode null? This might be the problem if your diagram does not support partly (or fully) disconnected links. If Link.FromNode is a Node, is the Node.Visible? (If not, is it a member of a visible Group?) If the Link.FromNode is non-null and visible, does it have a real Node.Position (i.e. not NaN for the .X and the .Y)? If the node doesn’t have a real position the link cannot calculate a reasonable route.

The same questions apply again for the Link.ToNode.

Anyway, I would check the link data in the model having the expected “From” and “To” values, and do the same for the Links in the Diagram.

I suppose to be more complete I should mention that maybe the link route does have points, but the points are all the same. But this does not sound likely from your description.

Are you seeing the link appear after performing some transaction even if it does not involve in any way the missing link or either connected node? I’m not sure, but that makes me wonder if perhaps the link data or its connections got added outside of a transaction. You could try setting Model.UndoManager.ChecksTransactionLevel = true and see if there are any output listener warning messages.

I’ve checked all of the values you’ve mentioned, and they all seem valid. Everything that should be set to visible is, and the position values are valid.

The link does appear when a transaction is completed not involving the link, which was making me think it was a transaction related problem… But this happens when the diagram is first loaded, so there aren’t any transactions at that point.

I set Model.UndoManager.ChecksTransactionLevel = true, but am not sure what I should be seeing from that?

Look for messages in the Output window of Visual Studio.

There doesn’t appear to be any messages in the Output window.

Can you think of any other potential causes for this? I realize there isn’t much to go off of here.

So have you confirmed that the unseen Link has no Points in its Link.Route.Points?

error that I am seeing is related to there not being any points in the
route… We have added code to make nodes jump to snap connected nodes
straight, so when the link doesn’t have any points we are seeing an
Could you explain? There are no Exceptions, right? What does your code do and when is it called and from what code?