The Wayback Machine - https://web.archive.org/web/20210508092036/https://github.com/dotnet/aspnetcore/issues/32516
Skip to content
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

Minimal Hosting - array support in method signatures #32516

Open
jchannon opened this issue May 8, 2021 · 0 comments
Open

Minimal Hosting - array support in method signatures #32516

jchannon opened this issue May 8, 2021 · 0 comments

Comments

@jchannon
Copy link
Contributor

@jchannon jchannon commented May 8, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant