Comments (7)
Hello and thanks!
The problem here is with GetRelativePoint
, which calculates the relative point based on the canvas container. While the canvas didn't render, Container
is null, so the calculation isn't possible.
The previous version returned null
in that case, but I felt that it doesn't make a lot of sense since you shouldn't be using methods that depend on Container
before it's initialized.
Solution: Don't use those methods in OnInitializedAsync
. Just set the position to null or something you already know.
Hope this helps!
from blazor.diagrams.
I have the same result using OnAfterRenderAsync instead of OnInitializedAsync. How can I be alerted when the container is initialized?
from blazor.diagrams.
There is a ContainerChanged
event in Diagram
. May I know why you need the relative point so soon?
from blazor.diagrams.
Upon investigation it seemed that we could eleminate the relative point. It was being called from a function that handled adding custom nodes and custom ports both at initialization and when when using drag/drop mouse interaction. It was not needed when seeding the diagram.
However I'm still encoutering a problem without it:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Blazor.Diagrams.Components.DiagramCanvas.get_LayerStyle()
at Blazor.Diagrams.Components.DiagramCanvas.BuildRenderTree(RenderTreeBuilder __builder)
I'll build a minimal example and see if I can isolate the problem
from blazor.diagrams.
Hello, you can find a minimal example here using blazor webassembly:
https://github.com/BjornEngelen/DiagramIssue
Upon opening the page, an error occurs
from blazor.diagrams.
Hello, not sure if it's normal but you're not setting a value to Diagram
.
Anyway, in 2.0.0, there is no need to specify Name
in the cascading value. Please use this: <CascadingValue Value="Diagram">
.
Tell me if you have any other issues.
from blazor.diagrams.
My bad on not initializing Diagram. I probably messed up my push. But your suggestion of not using Name did actually solve this issue in my full solution.
With Name="Diagram" I see:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Blazor.Diagrams.Components.DiagramCanvas.OnInitialized() in C:\Users\bjorn\Desktop\Blazor.Diagrams-master\src\Blazor.Diagrams\Components\DiagramCanvas.razor.cs:line 38
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
Without 'Name' the error is gone. Thanks
from blazor.diagrams.
Related Issues (20)
- V3 upgrade guide and v2 documentation HOT 2
- Examples link on home page not working HOT 2
- Exception when copying node HOT 1
- Default linewidth
- Auto-layout HOT 3
- Know when Diagram has finished rendering HOT 1
- Lock nodes and links in a diagram HOT 1
- Support for .Net 8 HOT 2
- Problem with initialization (Init order / Prerender / race condition?) HOT 2
- How to make links always attach to nodes orthogonally HOT 5
- Users can not select and delete a link when Segmentable == true HOT 2
- NullReferenceException when removing DrawNewLinkBehavior HOT 1
- Diagram layer size issue HOT 3
- Links not rendering HOT 2
- Can you create a sample project for .net 8
- NullReferenceException in `DiagramCanvas.OnInitialized()` on .NET 8 HOT 2
- Installation instructions may not work on NET 8 HOT 8
- Link HOT 1
- Application becomes unresponsive after page refresh HOT 1
- Link Not Rendered Correctly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blazor.diagrams.