Hello everyone,
I am running into an InvalidCastException when using a class with a property of type GUID. I believe that the at Syncfusion.EJ2.Blazor.BaseComponent.ChangeType method has problems converting a string value into a GUID object.
System.InvalidCastException: Invalid cast from 'System.String' to 'System.Guid'.
at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
at System.String.System.IConvertible.ToType(Type type, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType)
at Syncfusion.EJ2.Blazor.BaseComponent.ChangeType(Object value, Type conversionType)
at Syncfusion.EJ2.Blazor.BaseComponent.GetObject(Dictionary`2 Data, Type ModelType)
at Syncfusion.EJ2.Blazor.Grids.GridColumn.BuildRenderTree(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.ComponentBase.<.ctor>b__5_0(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.Rendering.Renderer.RenderInExistingBatch(RenderQueueEntry renderQueueEntry)
at Microsoft.AspNetCore.Components.Rendering.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint '/_blazor'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 6272.542600000001ms 101
I am trying to dynamically create the columns for the grid, as these are basically dependent on a Dictionary inside my DynamicEntity class.
For this I do overwrite the column template, to define how the grid can access the dictionary values.
Below my code for the grid. I did include it as link to PasteBin, as I could not find anything to include code directly into the forum thread.
@code section of the component:
And within my DynamicEntity class there exists a property of type Guid. As Guid does not implement the IConvertible interface, I think here lies the problem.
Is there some kind of possibility to attach a convertor to the Grid ? The only other solution for this problem which comes to my mind would be to implement something like a custom ConvertibleGuid-Type which does implement IConvertible.
Thank you for your help.
Best Regards,
Karl