csharp icon indicating copy to clipboard operation
csharp copied to clipboard

KubernetesYaml.Serialize Globalization issue

Open SGStino opened this issue 1 year ago • 0 comments

Describe the bug KubernetesYaml uses Culture dependant string formatting for floating point numbers.

Kubernetes C# SDK Client Version 13.0.11

Server Kubernetes Version N/A

Dotnet Runtime Version net8

To Reproduce

using k8s;
using System.Globalization;
CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-fr");
Console.WriteLine(KubernetesYaml.Serialize(new Dictionary<string, double>() { ["hello"] = 10.01 })); 
Console.WriteLine(KubernetesJson.Serialize(new Dictionary<string, double>() { ["hello"] = 10.01 }));
hello: 10,01
{"hello":10.01}

Expected behavior Yaml shouldn't be culture dependant, a decimal 10.01 should always, in any culture, be outputted with a decimal point in yaml.

KubeConfig N/A

Where do you run your app with Kubernetes SDK (please complete the following information):

  • OS: N/A
  • Environment: N/A
  • Cloud N/A

Additional context This is the source of this issue: https://github.com/buehler/dotnet-operator-sdk/issues/581

SGStino avatar Mar 01 '24 15:03 SGStino