Hi!
I use the <SfDiagramComponent> with a custom node template. Sometimes when I try to update the diagram
component with either DiagramRef.RefreshDataSource() or DiagramRef.AddDiagramElements(diagramObjects) a System.FormatException is thrown with the following message and stack trace:
'The input string '−2' was not in a correct format.' at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, ReadOnlySpan`1 value, TypeCode type)\n at System.Number.ParseDouble(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)\n at System.Double.Parse(String s, IFormatProvider provider)\n at Syncfusion.Blazor.Diagram.Internal.SVGCommand.<>c.<Parse>b__9_2(String arg)\n at System.Linq.Enumerable.WhereSelectArrayIterator`2[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7c…ontent.InitLayerObjects()\n at Syncfusion.Blazor.Diagram.Internal.DiagramLayerContent.InitObjects()\n at Syncfusion.Blazor.Diagram.Internal.DiagramLayerContent.RefreshDataSource()\n at Syncfusion.Blazor.Diagram.SfDiagramComponent.RefreshDataSource()What could cause this exception?
Hi Andreas,
We suspect that the node ID starts with a number, which is why the issue has been raised. At the framework level, there is a restriction that states you should set the ID with starting letters. The ID must begin with a letter ([A-Za-z]) and may be followed by any number of letters or digits ([0-9]). If you set the node's ID to start with a number, please update the proper node ID in your application. We have shared a user guide (UG) and a reference link for your convenience.
If you still persist with the issue, please share the sample to replicate your issue. These details help to provide a better solution for you.
HTML 4: https://www.w3.org/TR/html4/types.html#type-id
HTML 5: https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute
Regards,
Sumathi U.
Hi Sumathi!
Thank you, that solved the issue. I was using a GUID as ID, and didn't realize it didn't fit the ID string restriction. Now I only generate an ID with letters.
Sincerely,
Andreas
Hi Andreas,
You're welcome. We are glad to know that the reported problem has been resolved. Please let us know if you require any further assistance on this, we will be happy to assist you.
Regards,
Preethi R