Weird bug a colleague has encountered:
-
Weird bug a colleague has encountered:
A server implemented in C# receives JSON data and decodes it with System.Text.Json. The JSON data contains an array with null elements.
The server is running in a Docker container.
The server, when run on Windows, handles the JSON fine.
On a Ubuntu server it doesn't, because for some reason the decoded array contains null literals rather than a JsonElement of kind Null. That's a problem when a function expects a JsonElement, so C# throws an ArgumentNullException.
How the fuck does this happen? -
Weird bug a colleague has encountered:
A server implemented in C# receives JSON data and decodes it with System.Text.Json. The JSON data contains an array with null elements.
The server is running in a Docker container.
The server, when run on Windows, handles the JSON fine.
On a Ubuntu server it doesn't, because for some reason the decoded array contains null literals rather than a JsonElement of kind Null. That's a problem when a function expects a JsonElement, so C# throws an ArgumentNullException.
How the fuck does this happen?@volpeon "Multiplatform code"
-
@volpeon "Multiplatform code"
@Sparkwave It's funny because there are 2 layers of that, the dotnet runtime and the Docker container, and it still fails
-
@Sparkwave It's funny because there are 2 layers of that, the dotnet runtime and the Docker container, and it still fails
@volpeon inb4 a library uses this quirk to detect what OS the user is running
-
Weird bug a colleague has encountered:
A server implemented in C# receives JSON data and decodes it with System.Text.Json. The JSON data contains an array with null elements.
The server is running in a Docker container.
The server, when run on Windows, handles the JSON fine.
On a Ubuntu server it doesn't, because for some reason the decoded array contains null literals rather than a JsonElement of kind Null. That's a problem when a function expects a JsonElement, so C# throws an ArgumentNullException.
How the fuck does this happen?@volpeon first thing I would check is InvariantGlobalization being enabled. Causes the funniest things
-
Weird bug a colleague has encountered:
A server implemented in C# receives JSON data and decodes it with System.Text.Json. The JSON data contains an array with null elements.
The server is running in a Docker container.
The server, when run on Windows, handles the JSON fine.
On a Ubuntu server it doesn't, because for some reason the decoded array contains null literals rather than a JsonElement of kind Null. That's a problem when a function expects a JsonElement, so C# throws an ArgumentNullException.
How the fuck does this happen?@volpeon@icy.wyvern.rip what dotnet version? Also could you provide a small reproducable example? would lvoe to debug that (from linux point of view)
-
@volpeon@icy.wyvern.rip what dotnet version? Also could you provide a small reproducable example? would lvoe to debug that (from linux point of view)
@kura It's not my project and I don't have the means to do any investigation (I'm not even familiar with modern C#). He just came to me because initially he thought the problems were caused by my Node web app which communicates with the C# server.