Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

SmartComboBox not working on a French computer

Open
#48 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp
Domain
api, backend

Research direction

Start in SmartComponents.AspNetCore/SmartComboBox/SmartComboBoxEndpointRouteBuilderExtensions.cs, especially the similarityThreshold parsing around line 38. Reproduce the endpoint request on a French-locale system and inspect how the submitted decimal is parsed. Done means a French-formatted threshold is accepted without a bad request while the shown required-field and maxResults validation remains intact.

Written by the indexing model from the issue text.

Description

There is a problem in \smartcomponents\src\SmartComponents.AspNetCore\SmartComboBox\SmartComboBoxEndpointRouteBuilderExtensions.cs:

var form = httpContext.Request.Form;
if (!(form.TryGetValue("inputValue", out var inputValue) && !string.IsNullOrEmpty(inputValue))
    || !(form.TryGetValue("maxResults", out var maxResultsString) && int.TryParse(maxResultsString, NumberStyles.Integer, CultureInfo.InvariantCulture, out var maxResults))
    || !(form.TryGetValue("similarityThreshold", out var similarityThresholdString) && float.TryParse(similarityThresholdString, NumberStyles.Float, CultureInfo.InvariantCulture, out var similarityThreshold)))
{
    return Results.BadRequest("inputValue, maxResults, and similarityThreshold are required");
}

if (maxResults < 1 || maxResults > 100)
{
    return Results.BadRequest("maxResults must be less than or equal to 100");
}

In Line 38, I had to change the code to make it work on my French PC because similarityThresholdString was "0,5" (with a coma) and this fails in the float.TryParse

Here is the fixed code:

var form = httpContext.Request.Form;
if (!(form.TryGetValue("inputValue", out var inputValue) && !string.IsNullOrEmpty(inputValue)))
{
    return Results.BadRequest("inputValue is required");
}
if (!(form.TryGetValue("maxResults", out var maxResultsString) && int.TryParse(maxResultsString, NumberStyles.Integer, CultureInfo.InvariantCulture, out var maxResults)) )
{
    return Results.BadRequest("maxResults is required");
}
if (!(form.TryGetValue("similarityThreshold", out var similarityThresholdString)))
{
    return Results.BadRequest("similarityThreshold is required");
}
var similarityThreshold = float.Parse(similarityThresholdString.ToString().Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture);
if (maxResults < 1 || maxResults > 100)
{
    return Results.BadRequest("maxResults must be less than or equal to 100");
}
Dominant language
C#
Stars
510
Forks
61
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/smartcomponents

All issues in dotnet/smartcomponents

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.