Skip to content

Commit c61296e

Browse files
committed
fix keyed service test in environments that use comma (,) as decimal point, because string interpolation made 12.3 as 12,3 failing the compilation.
1 parent cf3710e commit c61296e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.KeyServices.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
3+
using System.Globalization;
34
using Microsoft.AspNetCore.Http.Metadata;
45
using Microsoft.AspNetCore.Http.RequestDelegateGenerator;
56
using Microsoft.Extensions.DependencyInjection;
@@ -99,7 +100,7 @@ public async Task SupportsSingleKeyedServiceWithCharKey()
99100
public async Task SupportsSingleKeyedServiceWithPrimitiveKeyTypes(object key)
100101
{
101102
var source = $$"""
102-
app.MapGet("/", (HttpContext context, [FromKeyedServices({{key.ToString()?.ToLowerInvariant()}})] TestService arg) => context.Items["arg"] = arg);
103+
app.MapGet("/", (HttpContext context, [FromKeyedServices({{Convert.ToString(key, CultureInfo.InvariantCulture)?.ToLowerInvariant()}})] TestService arg) => context.Items["arg"] = arg);
103104
""";
104105
var (_, compilation) = await RunGeneratorAsync(source);
105106
var myOriginalService = new TestService();

0 commit comments

Comments
 (0)