Nullreference exception when adding link model target/source ports
See original GitHub issueFor 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);
}
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:
Issue Analytics
- State:
- Created 10 months ago
- Comments:15
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
I’ll need more information. Firstly, how are you rendering your ports?