This is a migrated thread and some comments may be shown as answers.

.Net Core RC2 Json problem

3 Answers 412 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ion
Top achievements
Rank 1
Ion asked on 21 Oct 2020, 08:58 PM

Hi,

 

I have a .Net 5.0 RC2 Blazor WebAssembly application with System.Text.Json as json de/serialization support. I configured server project to serve reports, but I receive the error:

Property 'JsonResult.SerializerSettings' must be an instance of type 'System.Text.Json.JsonSerializerOptions'.

It is obvious that the error appears because the NewtonsoftJson package is missing - but I don't want to replace System.Text.Json de/serializing mechanism. The question is: is there a way to override/provide the json serializer settings and to skip this issue?

 

Thanks,

Ion

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 26 Oct 2020, 07:06 PM

Hi Ion,

We still don't support .NET 5, so we haven't tested the compatibility with Telerik Reporting. However, the error message you observed is very familiar. I observed a similar error when moving from .NET Core 2 to .NET Core 3 and it was related to a missing call to AddNewtonsoftJson(). The issue and the solution are described here, although I am not 100% sure the same solution is applicable to .NET 5. We have just started development of the .NET 5 support and plan to release it in the next official release. I will include the support for the Blazor WebAssembly scenario in the feature specifications.

Regards,
Nasko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Ion
Top achievements
Rank 1
answered on 27 Oct 2020, 07:13 AM

Hi Nasko,

Thanks for reply!

Any chance for the next release before the end of the year? I have a project under development having many reports, and I don't want to downgrade to NewtonsoftJson, which was officially replaced in .Net5, but I can delay the reporting development for 1-2 months, if needed.

Thanks!

0
Ion
Top achievements
Rank 1
answered on 29 Oct 2020, 07:41 AM

Hi,

After digging a bit, I found a workaround:

1. Add a new WebAPI project targeting .Net core 3.1 in solution

2. Enable CORS in Startup class

3. Move the Telerik.Reporting.Services.AspNetCore package, the ReportsController and the Reports folder here

4. Change the index.html in WebAssembly application to point the js files: <script src="http://{new_report_api_url}/api/reports/resources/js/telerikReportViewer"></script>

It is a temporary solution, which allows development until .Net 5 Json support will be added, but at least it works.

Tim
Top achievements
Rank 3
Iron
Iron
Iron
commented on 06 Aug 2021, 11:35 AM

Has .Net 5 Json support been added or is this still the recommended workaround?

In the workaround, does is the WebAPI a separate website that must be setup?

Thanks,

Tim

Neli
Telerik team
commented on 11 Aug 2021, 07:10 AM

Hi Tim,

Since R1 2021, we provide .NET5 support for our viewers and REST service. You can check our .NET5 demos that can be found in the installation folder of Telerik Reporting

C:\Program Files (x86)\Progress\Telerik Reporting R2 2021\Examples\CSharp\.NET 5\

Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
commented on 18 Nov 2021, 08:33 AM | edited

I think the question was about the System.Text.Json support and the dependency that Telerik Reporting has on NewtonsoftJson.

My understanting is that Microsoft is pushing System.Text.Json (faster and part of .net 5/6). Telerik Reporting still needs NewtonsoftJson to work creating "problems", especially in Blazor world where DTO from Telerik (Telerik.DataSource) need System.Text.Json, see Adding Reporting or Newtonsoft.Json breaks DataSourceRequest filters sending to the server | Telerik UI for Blazor or Chart not working with Newtonsoft.Json serialization properties | Telerik UI for Blazor.

Is there any news on when or if TelerikReporting will support System.Text.Json instead of Newtonsoft.Json?

Neli
Telerik team
commented on 22 Nov 2021, 12:42 PM

Hi Constantinos,

Тhere is currently a feature request about migrating to System.Text.Json that you may vote for to increase its priority - Migrate to System.Text.Json for serialization, instead of using Newtonsoft.Json. In the FR, there is also an admin edit explaining possible workarounds so that you may use Newtonsoft only for our service and thus not break the rest of the project.

Tags
General Discussions
Asked by
Ion
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Ion
Top achievements
Rank 1
Share this question
or