We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Syncfusion DataGrid : The converter specified on 'Syncfusion.Blazor.DataManager.Json' is not compatible with the type 'System.Collections.Generic.IEnu

Hi Folks,

Help me resolve below issue.. this is a simple copy-paste of grid code from site, but it is giving below error-

------------------

[2022-09-19T15:05:27.220Z] Error: System.InvalidOperationException: The converter specified on 'Syncfusion.Blazor.DataManager.Json' is not compatible with the type 'System.Collections.Generic.IEnumerable`1[System.Object]'.

at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(Type classTypeAttributeIsOn, MemberInfo memberInfo, Type typeToConvert)

at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.GetConverterFromAttribute(JsonConverterAttribute converterAttribute, Type typeToConvert, MemberInfo memberInfo, JsonSerializerOptions options)

at System.Text.Json.Serialization.Metadata.ReflectionJsonTypeInfo`1.CreateProperty(Type typeToConvert, MemberInfo memberInfo, JsonSerializerOptions options, Boolean shouldCheckForRequiredKeyword)

at System.Text.Json.Serialization.Metadata.ReflectionJsonTypeInfo`1.AddPropertiesAndParametersUsingReflection()

at System.Text.Json.Serialization.Metadata.ReflectionJsonTypeInfo`1..ctor(JsonConverter converter, JsonSerializerOptions options)

at System.Text.Json.Serialization.JsonConverter`1.CreateReflectionJsonTypeInfo(JsonSerializerOptions options)

at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.CreateJsonTypeInfo(Type type, JsonSerializerOptions options)

at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.GetTypeInfo(Type type, JsonSerializerOptions options)

at System.Text.Json.JsonSerializerOptions.GetTypeInfoNoCaching(Type type)

at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)

at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Boolean resolveIfMutable)

at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()

at System.Text.Json.Serialization.Metadata.JsonTypeInfo.InitializePropertyCache()

at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()

at System.Text.Json.Serialization.Metadata.JsonTypeInfo.g__ConfigureLocked|138_0()

at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Boolean resolveIfMutable)

at System.Text.Json.Serialization.JsonConverter.ResolvePolymorphicConverter(Object value, JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options, WriteStack& state)

at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

at System.Text.Json.Serialization.Converters.DictionaryDefaultConverter`3.OnWriteResume(Utf8JsonWriter writer, TDictionary value, JsonSerializerOptions options, WriteStack& state)

at System.Text.Json.Serialization.JsonDictionaryConverter`3.OnTryWrite(Utf8JsonWriter writer, TDictionary dictionary, JsonSerializerOptions options, WriteStack& state)

at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

at System.Text.Json.JsonSerializer.WriteCore[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo`1 jsonTypeInfo)

at System.Text.Json.JsonSerializer.WriteString[TValue](TValue& value, JsonTypeInfo`1 jsonTypeInfo)

at Syncfusion.Blazor.Grids.SfGrid`1.SerializeModel(SfGrid`1 comp)

at Syncfusion.Blazor.Grids.SfGrid`1.OnAfterRenderAsync(Boolean firstRender)

at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

------------------

code as below -

------------------

@page "/product/price/{Id:int}"


@inject IProductRepository _productRepository

@inject IProductPriceRepository _productPriceRepository


Product Price Management

@if (IsLoading)

{

}

else

{

@Product.Name

Category: @Product.Category.Name

Description: @((MarkupString)Product.Description)


}


@code {

[Parameter]

public int Id { get; set; }


private ProductDTO Product { get; set; } = new();

private IEnumerable ProductPrices { get; set; } = new List();

private bool IsLoading { get; set; } = true;


protected override async Task OnAfterRenderAsync(bool firstRender)

{

if (firstRender)

{

IsLoading = true;

StateHasChanged();

Product = await _productRepository.GetById(Id);

ProductPrices = await _productPriceRepository.GetAll(Id);

IsLoading = false;

StateHasChanged();

}

}

//public async void ActionHandler(ActionEventArgs args)

//{


//}

}


------------------

*based on the documentation [link: blazor.syncfusion.com/documentation/datagrid/data-binding] I tried passing TValue but no luck.

*I have also configured : NewtonsoftJson, based on syncfusion help posts for Syncfusion.Blazor.DataManager.Json errors.


Help me overcome this issue..


Thanks in Advance.


14 Replies 1 reply marked as answer

NP Naveen Palanivel Syncfusion Team September 21, 2022 04:19 AM UTC

Hi Avinash,


Greetings from Syncfusion support.


We checked your query and you facing issue.We need some more information, Kindly share the below details to validate further at our end.


  1. Share us entire Grid code snippet along with model class.
  2. Share us the video demonstration of the issue with detailed replication procedure.
  3. If possible share us an simple issue reproduceable sample

The above-requested details will be helpful for us to validate the reported query at our end and provide the solution as early as possible.


Regards,

Naveen Palanivel



AK Avinash Kumar replied to Naveen Palanivel September 21, 2022 06:55 AM UTC

Dear Navin,


Thanks for your reply.

To understand issue clearly... I have created new page with the demo example scenario.


Sharing you the scripts below:

-------------------------- Script Start --------------------------

@page "/product/price1/{Id:int}"


<h3>ProdPrice</h3>


<SfGrid DataSource="Orders">

</SfGrid>


@code {

    [Parameter]

    public int Id { get; set; }

    public List<Order> Orders { get; set; }

    protected override void OnInitialized()

    {

        Orders = Enumerable.Range(1, 15).Select(x => new Order()

            {

                OrderId = 1000 + x,

                CustomerId = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],

                Freight = 2.1 * x,

                OrderDate = DateTime.Now.AddDays(-x)

            }).ToList();

    }

    public class Order

    {

        public int? OrderId { get; set; }

        public string CustomerId { get; set; }

        public DateTime? OrderDate { get; set; }

        public double? Freight { get; set; }

    }

}

-------------------------- Script End --------------------------

Script is just a copy paste of video example.

This is generating same error message as shared earlier.


--------------------- Error message Start-------------------

blazor.server.js:1


       [2022-09-21T06:51:02.399Z] Error: System.InvalidOperationException: The converter specified on 'Syncfusion.Blazor.DataManager.Json' is not compatible with the type 'System.Collections.Generic.IEnumerable`1[System.Object]'.

   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(Type classTypeAttributeIsOn, MemberInfo memberInfo, Type typeToConvert)

   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.GetConverterFromAttribute(JsonConverterAttribute converterAttribute, Type typeToConvert, MemberInfo memberInfo, JsonSerializerOptions options)

   at System.Text.Json.Serialization.Metadata.ReflectionJsonTypeInfo`1.CreateProperty(Type typeToConvert, MemberInfo memberInfo, JsonSerializerOptions options, Boolean shouldCheckForRequiredKeyword)

   at System.Text.Json.Serialization.Metadata.ReflectionJsonTypeInfo`1.AddPropertiesAndParametersUsingReflection()

   at System.Text.Json.Serialization.Metadata.ReflectionJsonTypeInfo`1..ctor(JsonConverter converter, JsonSerializerOptions options)

   at System.Text.Json.Serialization.JsonConverter`1.CreateReflectionJsonTypeInfo(JsonSerializerOptions options)

   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.CreateJsonTypeInfo(Type type, JsonSerializerOptions options)

   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.GetTypeInfo(Type type, JsonSerializerOptions options)

   at System.Text.Json.JsonSerializerOptions.GetTypeInfoNoCaching(Type type)

   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)

   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Boolean resolveIfMutable)

   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()

   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.InitializePropertyCache()

   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()

   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureLocked|138_0()

   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Boolean resolveIfMutable)

   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.get_ElementTypeInfo()

   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)

   at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

   at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

   at System.Text.Json.Serialization.JsonConverter`1.WriteCoreAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)

   at System.Text.Json.JsonSerializer.WriteCore[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo`1 jsonTypeInfo)

   at System.Text.Json.JsonSerializer.WriteString[TValue](TValue& value, JsonTypeInfo`1 jsonTypeInfo)

   at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options)

   at Syncfusion.Blazor.Internal.SfBaseUtils.Equals[T](T oldValue, T newValue)

   at Syncfusion.Blazor.SfDataBoundComponent.UpdateProperty[T](String propertyName, T publicValue, T privateValue, Object eventCallback, Expression`1 expression)

   at Syncfusion.Blazor.Grids.SfGrid`1.UpdateProperties(String propertyName, Object newValue)

   at Syncfusion.Blazor.Grids.Internal.Preloader`1.OnParametersSetAsync()

   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)

   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()

log @ blazor.server.js:1

--------------------- Error message End ------------------------


Do let me know if you want to know anything else.


Regards,



NP Naveen Palanivel Syncfusion Team September 23, 2022 03:42 AM UTC

Hi Avinash,


We checked your query and prepared sample by given code in ticket. But, Unfortunately reported issue does not occurs at our end. We attached the sample in this ticket , Please refer the attached sample for reference


Please let us know if you have any concerns.


Regards,

Naveen Palanivel


Attachment: BlazorApp1_12b68a71.zip


RA René Astad Dupont September 23, 2022 12:14 PM UTC

I have the same problem. It is connected to .Net 7.0 rc1. Rolling back to .Net 6.0 solved the problem for me for now.



PE Pål Eirik Pettersen replied to René Astad Dupont September 23, 2022 07:57 PM UTC

Same here




NP Naveen Palanivel Syncfusion Team September 26, 2022 06:02 PM UTC

Hi All,


We have analyzed your query and we would like to inform you that currently our Syncfusion components have only support for .NET6 version only. Hence the reported issue occur in while creating the application in .NET7. Reported issue will be resolved after upgrading our component to .NET 7.


Until then we appreciate your patience.


Regards,

Naveen Palanivel



GW Giles Wakefield replied to Naveen Palanivel October 3, 2022 11:22 AM UTC

Hi Naveen,

I appear to have this exact problem, and I am using .Net 7.0 RC1.  I see that you state this will be fixed when you've upgraded to .Net 7.0, but on this page:

https://www.syncfusion.com/products/whatsnew/blazor-components

It states: " All Syncfusion Blazor components are compatible with .NET 7."


I am using .Net 7.0.100-rc.1.22431.12

And nuget packages (all V20.3.0.47)

Syncfusion.Blazor.Buttons

Syncfusion.Blazor.Themes

Syncfusion.Blazor.Grid


I have a fairly basic situation with a "CustomerDto" class, and using either an IEnumerable<CustomerDto> or a List<CustomerDto> as the DataSource for the <sfGrid> I have this exact error:


"Unhandled exception rendering component: The converter specified on 'Syncfusion.Blazor.DataManager.Json' is not compatible with the type 'System.Collections.Generic.IEnumerable`1[System.Object]'."

Could you confirm that this is expected to work now?



NP Naveen Palanivel Syncfusion Team October 5, 2022 03:37 AM UTC

Hi Giles,


We would like to inform you that our Components has compatible with .NET 7 Preview versions. But we have problems with serialization processes. Currently, we have checking with RC versions and need some more time to validate this. We update the further details on October 6th, 2022 since ensuring process take time to confirmation.



Please let us know if you have any concerns.


Regards,

Naveen Palanivel



GW Giles Wakefield October 7, 2022 10:34 AM UTC

Hi Naveen,

Since it has gone past the 6th October now, I just had a look and noticed there were some updated Nuget Packages available, so I tried these.


The grid does seem to be doing a bit more now (it now has a Navigation bar which wasn't rendering before) but is still giving the same sort of error. 


If there is anything you can suggest I try, or information you would like me to add, please let me know.



PE Pål Eirik Pettersen October 11, 2022 10:20 AM UTC

Hi Naveen,

Any new development regarding the problem with serialization?


Regards,

Pål Eirik



NP Naveen Palanivel Syncfusion Team October 12, 2022 03:28 AM UTC

Hi All,


Thanks for the patience.


we have included fix for the issue the problem with serialization in .Net 7in our volume release (20.3.0.49).  So please upgrade to our latest version of Syncfusion NuGet package to resolve the reported issue.



Please let us know if you have any concerns.

   

Regards,            

Naveen


Marked as answer

PE Pål Eirik Pettersen October 12, 2022 07:43 PM UTC

Hi Naveen,

Seems like 20.3.0.49 solved my problem. Thank you :)


Regards 

Pål Eirik

 



SG Suganya Gopinath Syncfusion Team October 13, 2022 02:41 PM UTC

Hi Pål Eirik,

If this post is helpful, please consider accepting it as the solution so that other members can locate it more quicky.

Regards,

Suganya Gopinath.





RO Robert replied to Suganya Gopinath October 30, 2022 05:50 AM UTC

Same issue with .Net6 i Upgraded my License and updated my Nuget Packages and it works now only took 1 month to figure this out 


Loader.
Live Chat Icon For mobile
Up arrow icon