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

Upgrade SignalR to .net Core SignalR- field names incorrect, Cannot read property 'getTimezoneOffset' of null

3 Answers 291 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Veteran
Andy asked on 20 Jun 2020, 01:38 PM
     Just a heads up on what I found upgrading to .net Core in my SignalR implementation. The Core version automatically camel cases field names, so when I was pulling field names in my schema, StartDate came up as startDate, so my schema pulling "from: StartDate" gave me a null field. Hope that helps someone.

3 Answers, 1 is accepted

Sort by
0
Aleksandar
Telerik team
answered on 23 Jun 2020, 01:09 PM

Hello Andy,

Depending on the ASP.NET Core version the default JSON serializer behavior differs and as you have observed properties may be passed in camel case or pascal case. We have provided guidelines on how to configure the JSON serializer so that the property name casing doesn't change during serialization:

https://docs.telerik.com/aspnet-core/compatibility/json-serialization

Regards,
Aleksandar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Andy
Top achievements
Rank 1
Veteran
answered on 23 Jun 2020, 05:57 PM
Thanks for the link. That's very useful for api and odata calls, but I don't know of such a setting to affect signalr transactions, so I believe I'll have to deal with camel cased variable names.
0
Aleksandar
Telerik team
answered on 25 Jun 2020, 12:19 PM

Hello,

JSON serialization can be configured on the server using the AddJsonProtocol method. The method can be added after AddSignalR in Startup.ConfigureServices. You can also try setting the configuration following the guidance in this article:

https://docs.microsoft.com/en-us/aspnet/core/signalr/configuration?view=aspnetcore-3.1&tabs=dotnet

Regards,
Aleksandar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Data Source
Asked by
Andy
Top achievements
Rank 1
Veteran
Answers by
Aleksandar
Telerik team
Andy
Top achievements
Rank 1
Veteran
Share this question
or