Skip to content

Sieve does not work with asp.net core minimal API's #181

@klyse

Description

@klyse

Describe the bug
The new asp.net core minimal api's are not able to handle the SieveModel

To Reproduce
Steps to reproduce the behaviour:

  • Create a new project and use the minimal API.
  • Map any Get request: app.MapGet("/test", ([FromQuery] SieveModel model) => { });
  • Start the app and make the first request to the /test endpoint

Expected behaviour
The app starts and binds the SieveModel

Actual behvaiour
Exception is thrown:

[11:00:53 ERR] An unhandled exception has occurred while executing the request. => Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware
System.InvalidOperationException: No public static bool SieveModel.TryParse(string, out SieveModel) method found for model.
   at Microsoft.AspNetCore.Http.RequestDelegateFactory.BindParameterFromValue(ParameterInfo parameter, Expression valueExpression, FactoryContext factoryContext, String source)
   at Microsoft.AspNetCore.Http.RequestDelegateFactory.CreateArgument(ParameterInfo parameter, FactoryContext factoryContext)
   at Microsoft.AspNetCore.Http.RequestDelegateFactory.CreateArguments(ParameterInfo[] parameters, FactoryContext factoryContext)
   at Microsoft.AspNetCore.Http.RequestDelegateFactory.CreateTargetableRequestDelegate(MethodInfo methodInfo, Expression targetExpression, FactoryContext factoryContext, Expression`1 targetFactory)
...

Desktop (please complete the following information):

  • OS: macos
  • dotnet 7.0.0-preview.7.22376.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions