Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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.

Assessment

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

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.

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?

Dominant language
C#
Stars
1.5k
Forks
319
PR merge metrics
No merged PRs in 30d

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

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.

More from microsoft/automatic-graph-layout

All issues in microsoft/automatic-graph-layout

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.