AspNetCoreOData
AspNetCoreOData copied to clipboard
Error details has platform-specific linebreaks
Assemblies affected ASP.NET Core OData 8.2.4
Describe the bug
Validation error contains the field details. It might be something like this for the error:
Content\r\nInvalid
on a Windows server.
On a Linux server it will be:
Content\nInvalid
Expected behavior I'm not that experienced in the RFC but I would expect it to be consistent? The important thing is who parses it not who produces.
Can you please provide a bit more detail on this issue? What validation error are you referring to exactly here? Is there a sample?
Can you please provide a bit more detail on this issue? What validation error are you referring to exactly here? Is there a sample?
+1
@sherlock1982 can you share more details to let us help you resolve the problem?
FYI. OData JSON serializer is using its own JSON writer which depends on 'TextWriter'. For TextWriter, it has the NewLine configuration using https://learn.microsoft.com/en-us/dotnet/api/system.io.textwriter.newline?view=net-8.0https://learn.microsoft.com/en-us/dotnet/api/system.io.textwriter.newline?view=net-8.0.
If you want to config it, you can create a JOSN writer factory (by implementing https://github.com/OData/odata.net/blob/main/src/Microsoft.OData.Core/Json/IJsonWriterFactory.cs) to config the TextWriter, then return a IJsonWriter to finish the writing. Thanks.