Found while upgrading a company codebase to .NET 8, rendering a DiagramCanvas always triggers NRE.
Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Blazor.Diagrams.Components.DiagramCanvas.OnInitialized()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
Looking at the implementation of DiagramCanvas.OnInitialized, the only thing would reasonably be causing the NRE is BlazorDiagram.Changed += OnDiagramChanged;. I can confirm the diagram that we pass in is non-null, but it's also pretty sus that that line isn't in OnParametersSet instead.
In fact, I'm amazed that all of this worked at all previously, since the DiagramCanvas hasn't been touched for 2 years, and Blazor's initialation logic hasn't been touched in 3 years (meaning it has always called OnInitialized() before OnParametersSet()).
This is blocking our upgrade to .NET 8, and that in turn is blocking other work items.
Found while upgrading a company codebase to .NET 8, rendering a
DiagramCanvas
always triggers NRE.Looking at the implementation of
DiagramCanvas.OnInitialized
, the only thing would reasonably be causing the NRE isBlazorDiagram.Changed += OnDiagramChanged;
. I can confirm the diagram that we pass in is non-null, but it's also pretty sus that that line isn't inOnParametersSet
instead.In fact, I'm amazed that all of this worked at all previously, since the
DiagramCanvas
hasn't been touched for 2 years, and Blazor's initialation logic hasn't been touched in 3 years (meaning it has always calledOnInitialized()
beforeOnParametersSet()
).This is blocking our upgrade to .NET 8, and that in turn is blocking other work items.