question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nullreference exception when adding link model target/source ports

See original GitHub issue

For some reason the following code throws a NRE Am I doing something wrong?

            Diagram.Nodes.Add(current);

            if (parent is not null)
            {
                var link = new LinkModel(parent, current)
                {
                    TargetMarker = LinkMarker.Arrow
                };
                link.SetSourcePort(parent.GetPort(PortAlignment.Bottom));
                link.SetTargetPort(current.GetPort(PortAlignment.Top));
                Diagram.Links.Add(link);
            }

image

Stacktrace:

   at Blazor.Diagrams.Core.Layers.LinkLayer.OnItemAdded(BaseLinkModel link)
   at Blazor.Diagrams.Core.BaseLayer`1.Add(T item)
   at ForkHierarchy.Pages.Index.<RenderNodeAsync>d__24.MoveNext()

Checking whether I am adding a null value to SetSource/TargetPort, shows me that they do have values: image

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
AlmightyLkscommented, Nov 12, 2022

Oh! I didn’t know you had to add a PortRenderer to the custom node razor file! 😄 My bad

With this all my questions in this regards were answered. Thanks

0reactions
zHaytamcommented, Nov 12, 2022

I’ll need more information. Firstly, how are you rendering your ports?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove port with it's link and target port #659
I ran into issue when trying to remove port with its link and related (target) port. I'm successed only with removing source port...
Read more >
Detecting what the target object is when ...
All I want is the word "foo" (the name of the reference that was null in your example) in the exception object somewhere!...
Read more >
Nmap Advanced Port Scans | TryHackMe (THM) | by Aircon
Just like with “NULL Scan,” the target system will react with a “RST” if the port is closed, so that we can determine...
Read more >
How can I fix the error: System.NullReferenceException
A NullReferenceException exception is thrown when you try to access a member on a type whose value is null. A NullReferenceException exception ......
Read more >
object reference not set to an instance of an object.
Everything seems to work fine up until enabling the components, which I get a NullReferenceException in the console.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found