Skip to content

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

Closed

Description

@DGuhr

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.

Activity

  1. added
    bugSomething isn't working
    on Apr 9, 2025
  2. added a commit that references this issue on Apr 9, 2025
    9bec4ea
  3. added a commit that references this issue on Apr 9, 2025
    43266ad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions