Skip to content

WeatherTools Quickstart: GetForecast in Server not working in some Cultures / geos #248

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

Closed
DGuhr opened this issue Apr 9, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@DGuhr
Copy link
Contributor

DGuhr commented Apr 9, 2025

Describe the bug
Because string interpolation in C# uses the current culture by default, it might insert commas instead of dots for decimals in some locales. If latitude or longitude contain decimal values, which they do, the URL "/points/..." here won’t match the expected format of the weather API when using a culture with a comma decimal separator (e.g. germany, france, ...).

Using CultureInfo.InvariantCulture ensures the decimal separator is always . and prevents the URL from breaking.
To Reproduce
Steps to reproduce the behavior:

  1. Set your system / tool to use one of the affected cultures (e.g. using CultureInfo.CreateSpecificCulture("de-DE")
  2. build the server sample with the tool and invoke a GetForecast call
  3. see it failing bc. it's now (made-up) 28,2 instead of 28.2 which leads to an error response.

Expected behavior
The samples should work everywhere.

Logs
If applicable, add logs to help explain your problem.

Additional context
First raised here in the docs repo, and there was the idea to fix it via this docs pr (see comments). This was closed in favour of #134 (which seems to be upstream for the docs quickstart). I left a comment and was asked to create a follow up issue. This is the follow up issue.

@DGuhr DGuhr added the bug Something isn't working label Apr 9, 2025
DGuhr added a commit to DGuhr/csharp-sdk that referenced this issue Apr 9, 2025
…string interpolation for langitude and longitude so the sample works everywhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant