microsoft / microsoft/automatic-graph-layout

NullReferenceException in >GraphViewer.CreateRectToFillCanvas() when re-assigning the graph

Open
#310 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.5k
Forks
319
Avg merge
38m
Merged PRs (30d)
1

Description

hi, when using the AutomaticGraphLayoutControl, assigning a graph, then assigning null and then assigning the same graph (I didn't test with a different graph...), a NRE is thrown because the Parent of the GraphCanvas was null.

this is fixed by changing the way AutomaticGraphLayoutControl.SetGraph() handles the re-assignment case... just some if statements need to be changed.
i have a fix in my fork. should i PR it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with AutomaticGraphLayoutControl.SetGraph() and follow the re-assignment path into GraphViewer.CreateRectToFillCanvas(). Reproduce assigning a graph, assigning null, and assigning the same graph again; done means the sequence no longer throws a NullReferenceException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.