Closed
Description
Describe the bug
When using the ASPP.NET 6 minimal hosting, querystring binding does not work with arrays/lists
To Reproduce
app.MapGet("/qs/{id:int}", HttpHandlers.GetByQueryString);
public static string GetByQueryString(int id, string name, int[] values)
{
return id + " " + name + string.Join(",", values);
}
Adding [FromQuery(Name = "values")]
to the method signature does not help either.
Exceptions (if any)
An exception is thrown when sending in a request:
curl http://localhost:5000/qs/123\?name\=dave\&values\=1\&values\=2
Unhandled exception. System.InvalidOperationException: No public static bool Int32[].TryParse(string, out Int32[]) method found for values.
Further technical details
- ASP.NET Core version 6
.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.5.21252.2
Commit: 921395c33e
Runtime Environment:
OS Name: Mac OS X
OS Version: 11.3
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /Users/jonathan/.dotnet/sdk/6.0.100-preview.5.21252.2/
Host (useful for support):
Version: 6.0.0-preview.5.21251.4
Commit: d2fba8fdc4
.NET SDKs installed:
2.1.809 [/Users/jonathan/.dotnet/sdk]
3.1.401 [/Users/jonathan/.dotnet/sdk]
3.1.403 [/Users/jonathan/.dotnet/sdk]
5.0.103 [/Users/jonathan/.dotnet/sdk]
6.0.100-preview.5.21229.26 [/Users/jonathan/.dotnet/sdk]
6.0.100-preview.5.21252.2 [/Users/jonathan/.dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.21 [/Users/jonathan/.dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.21 [/Users/jonathan/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [/Users/jonathan/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [/Users/jonathan/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [/Users/jonathan/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.5.21229.9 [/Users/jonathan/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.5.21230.5 [/Users/jonathan/.dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.21 [/Users/jonathan/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [/Users/jonathan/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [/Users/jonathan/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [/Users/jonathan/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.5.21229.1 [/Users/jonathan/.dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.5.21251.4 [/Users/jonathan/.dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Metadata
Metadata
Assignees
Labels
This issue tracks updating documentationWork that is important, but not critical for the releaseIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcThis issue represents an ask for new feature or an enhancement to an existing oneController-like actions for endpoint routing*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels