Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output: interpolated strings & culture #307

Closed
ig-sinicyn opened this issue Nov 24, 2016 · 1 comment · Fixed by #346
Closed

Output: interpolated strings & culture #307

ig-sinicyn opened this issue Nov 24, 2016 · 1 comment · Fixed by #346
Assignees
Labels
Milestone

Comments

@ig-sinicyn
Copy link
Contributor

There're places in the codebase that fails to pass the host culture into formatted strings,
as example:

            builder.AppendLine($"Skewness = {s.Skewness}, Kurtosis = {s.Kurtosis}");

the output is

ConfidenceInterval = [45.8375 us; 45.8375 us] (CI 95%)
Skewness = не число, Kurtosis = не число

hotfix: just add .ToStr()

Sadly, there's no good solution for it. You can wrap all interpolated strings into

using static System.FormattableString;
...
            builder.AppendLine(Invariant($"Skewness = {s.Skewness}, Kurtosis = {s.Kurtosis}"));

but it'll result in additional FormattableString instantiation per call, not to mention issue with targeting to 4.5.
Long story short, string interpolation does not play well with logging : (

@AndreyAkinshin
Copy link
Member

It seems that we should just use the .ToStr() hotfix, I don't know a good solution for this problem.

@AndreyAkinshin AndreyAkinshin self-assigned this Dec 12, 2016
@AndreyAkinshin AndreyAkinshin added this to the v0.10.2 milestone Dec 12, 2016
alinasmirnova added a commit to alinasmirnova/BenchmarkDotNet that referenced this issue Jan 14, 2017
alinasmirnova added a commit to alinasmirnova/BenchmarkDotNet that referenced this issue Jan 14, 2017
AndreyAkinshin added a commit that referenced this issue Jan 14, 2017
Used ToStr to make statistics builder culture invariant (fixed #307)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants