InvalidOperationException in SdShortestPath
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- computer-graphics
Research direction
Add the minimum reproducer to WpfApplicationSample and start at SdShortestPath.RouteEdgeWithGroups, where the call stack reports the exception at line 183. Run the sample with the default edge-routing mode rather than the StraightLine workaround, and consider the issue done when the graph renders without InvalidOperationException.
Written by the indexing model from the issue text.
Description
Hello,
In rare cases, I get an InvalidOperationException in SdShortestPath.RouteEdgeWithGroups.
I reduced my failing graph to the following minimum example that reproduces the problem.
// Add code for example to WpfApplicationSample.
var graph = new Graph();
var ds = new Subgraph("DataStructure");
var dds = new Subgraph("DeviceDataStructure");
graph.RootSubgraph.AddSubgraph(ds);
ds.AddSubgraph(dds);
var n = graph.AddNode("CatalogSetToDefaults");
dds.AddNode(n);
graph.AddNode("Contracts");
graph.AddEdge("DeviceDataStructure", "Contracts");
graph.AddEdge("Contracts", "DeviceDataStructure");
graphViewer.Graph = graph;
Callstack where the InvalidOperationException is thrown.
> Microsoft.Msagl.dll!Microsoft.Msagl.Routing.Spline.Bundling.SdShortestPath.RouteEdgeWithGroups() Line 183 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.Spline.Bundling.SdShortestPath.RouteEdge(Microsoft.Msagl.Core.Layout.EdgeGeometry edgeGeometry = {Microsoft.Msagl.Core.Layout.EdgeGeometry}) Line 155 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.Spline.Bundling.SdShortestPath.RouteEdges() Line 77 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.Spline.Bundling.BundleRouter.RoutePathsWithSteinerDijkstra() Line 233 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.Spline.Bundling.BundleRouter.RunInternal() Line 101 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Core.AlgorithmBase.Run() Line 17 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.MultiEdgeRouter.Run() Line 37 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.SplineRouter.RouteMultiEdges(System.Collections.Generic.List<Microsoft.Msagl.Core.Layout.Edge[]> multiEdges = Count = 1, Microsoft.Msagl.Routing.InteractiveEdgeRouter interactiveEdgeRouter = {Microsoft.Msagl.Routing.InteractiveEdgeRouter}, Microsoft.Msagl.Core.DataStructures.Set<Microsoft.Msagl.Routing.Shape> parents = {Microsoft.Msagl.Core.DataStructures.Set<Microsoft.Msagl.Routing.Shape>}) Line 367 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.SplineRouter.RouteEdgesWithTheSamePassport(System.Linq.IGrouping<Microsoft.Msagl.Core.DataStructures.Set<Microsoft.Msagl.Routing.Shape>, Microsoft.Msagl.Core.Layout.Edge> edgeGeometryGroup = Key = {Microsoft.Msagl.Core.DataStructures.Set<Microsoft.Msagl.Routing.Shape>}, Microsoft.Msagl.Routing.InteractiveEdgeRouter interactiveEdgeRouter = {Microsoft.Msagl.Routing.InteractiveEdgeRouter}, Microsoft.Msagl.Core.DataStructures.Set<Microsoft.Msagl.Routing.Shape> obstacleShapes = {Microsoft.Msagl.Core.DataStructures.Set<Microsoft.Msagl.Routing.Shape>}) Line 325 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.SplineRouter.RouteOnVisGraph() Line 307 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.SplineRouter.RouteOnRoot() Line 188 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Routing.SplineRouter.RunInternal() Line 171 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Core.AlgorithmBase.Run(Microsoft.Msagl.Core.CancelToken cancelToken = {Microsoft.Msagl.Core.CancelToken}) Line 49 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Miscellaneous.LayoutHelpers.RouteAndLabelEdges(Microsoft.Msagl.Core.Layout.GeometryGraph geometryGraph = {Microsoft.Msagl.Core.Layout.GeometryGraph}, Microsoft.Msagl.Core.Layout.LayoutAlgorithmSettings layoutSettings = {Microsoft.Msagl.Layout.Layered.SugiyamaLayoutSettings}, System.Collections.Generic.IEnumerable<Microsoft.Msagl.Core.Layout.Edge> edgesToRoute = {Microsoft.Msagl.Core.Layout.Edge[2]}, int straighLineRoutingThreshold = 0, Microsoft.Msagl.Core.CancelToken cancelToken = {Microsoft.Msagl.Core.CancelToken}) Line 222 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Miscellaneous.LayoutHelpers.ProcessSugiyamaLayout(Microsoft.Msagl.Core.Layout.GeometryGraph geometryGraph = {Microsoft.Msagl.Core.Layout.GeometryGraph}, Microsoft.Msagl.Layout.Layered.SugiyamaLayoutSettings sugiyamaLayoutSettings = {Microsoft.Msagl.Layout.Layered.SugiyamaLayoutSettings}, Microsoft.Msagl.Core.CancelToken cancelToken = {Microsoft.Msagl.Core.CancelToken}) Line 102 C#
Microsoft.Msagl.dll!Microsoft.Msagl.Miscellaneous.LayoutHelpers.CalculateLayout(Microsoft.Msagl.Core.Layout.GeometryGraph geometryGraph = {Microsoft.Msagl.Core.Layout.GeometryGraph}, Microsoft.Msagl.Core.Layout.LayoutAlgorithmSettings settings = {Microsoft.Msagl.Layout.Layered.SugiyamaLayoutSettings}, Microsoft.Msagl.Core.CancelToken cancelToken = {Microsoft.Msagl.Core.CancelToken}, string tileDirectory = null) Line 58 C#
Microsoft.Msagl.WpfGraphControl.dll!Microsoft.Msagl.WpfGraphControl.GraphViewer.LayoutGraph() Line 820 C#
As a workaround I can use following setting:
graph.LayoutAlgorithmSettings.EdgeRoutingSettings.EdgeRoutingMode = EdgeRoutingMode.StraightLine;
With this setting the graph is rendered. So I assume it is not a problem with the graph.
Here is the graph rendered with this workaround.
Note there is an older issue from 2016 that seems to be the same problem.
#92
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 319
- Avg merge
- 38m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/automatic-graph-layout
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
microsoft/automatic-graph-layout#395 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
microsoft/automatic-graph-layout#390 · 6 comments · 2 reactions · 2 assignees ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
microsoft/automatic-graph-layout#389 · 1 comment · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
All issues in microsoft/automatic-graph-layout
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·