Azure / azure-functions-signalrservice-extension

Azure Functions bindings for SignalR Service. Project moved to https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/signalr/Microsoft.Azure.WebJobs.Extensions.SignalRService .
MIT License
97 stars 47 forks source link

Use of JsonConvert.DefaultSettings breaks unrelated serialization in v1.4 #229

Closed seancolonello closed 3 years ago

seancolonello commented 3 years ago

Upgrading from version 1.3.0 to 1.4.0 resulted in breaking changes for other aspects of my project. The project uses JsonConvert.SerializeObject() with default settings, which retains the POCO property casing (PascalCase in my situation). After the 1.4 update JsonConvert.SerializeObject() defaults to camelCase. This is running locally via Visual Studio 2019, I'm not sure if the same behavior exists deployed to Azure infrastructure.

I assume it's due to the following code fragment in SignalRConfigProvider.Initialize(), which is marked [Obsolete("preview")].

https://github.com/Azure/azure-functions-signalrservice-extension/blob/dbe3704a6e45f0624183d4152296197fad7ec253/src/SignalRServiceExtension/Config/SignalRConfigProvider.cs#L68-L75

I'd say it's bad practice to set global serialization defaults in a library like this, that should be reserved for top level applications. Custom JsonSerializerSettings should be passed via the appropriate overload to JsonConvert methods.

Y-Sindo commented 3 years ago

Thanks for your feedback. We will consider improve it.