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

Strange behavior of minimal api when using it in fsharp #46551

Open
1 task done
vshapenko opened this issue Feb 9, 2023 · 3 comments
Open
1 task done

Strange behavior of minimal api when using it in fsharp #46551

vshapenko opened this issue Feb 9, 2023 · 3 comments
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Milestone

Comments

@vshapenko
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hello! I am trying to use minimal api from fsharp, and encountered a following problem:

https://gist.github.com/vshapenko/5c6ae1c0cb005dddd1325caca266ecd4

First method in gist above works as intended, second and third do not pass value to handler.

Can somebody explain this strange behavior?

Expected Behavior

All methods returns input string

Steps To Reproduce

Run the gist above, invoke endpoints

Exceptions (if any)

No response

.NET Version

7.0.100

Anything else?

No response

@javiercn javiercn added the area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels label Feb 9, 2023
@captainsafia
Copy link
Member

@vshapenko Thanks for filing this issue! We don't have capacity to investigate at the moment and will place it in the backlog. You can try filing it on StackOverflow to see if folks from the F# community might have some insight on this.

@captainsafia captainsafia added this to the Backlog milestone Mar 14, 2023
@ghost
Copy link

ghost commented Mar 14, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@captainsafia captainsafia added area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc and removed area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels labels Jun 6, 2023
@lucasteles
Copy link

@vshapenko This happens because of how F# deals with Delegates, an F# function is not the same as a C# lambda/delegate.

So, there is no information about the parameter name when you construct a Func<> using an already existing F# function and ASPNET is unable to bind the parameter correctly

The first case is working because the F# compiler when see you directly calling a lambda on an Expression<Func<>> or Func<> emits a compatible delegate type

More here fsharp/fslang-suggestions#1083
and here fsharp/fslang-suggestions#1131

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Projects
None yet
Development

No branches or pull requests

5 participants