-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Add support for F# Async<'T>
as an awaitable type in minimal APIs
#46898
Add support for F# Async<'T>
as an awaitable type in minimal APIs
#46898
Conversation
* Use `CoercedAwaitableInfo` to convert `FSharp.Control.FSharpAsync<T>` values to `System.Threading.Tasks.Task<TResult>` when building request delegates and populate endpoint metadata accordingly.
* Add a comment to the request delegate source generator tests that explicitly calls out that F# async is not currently supported by the source generator.
Thanks for your PR, @brianrourkeboll. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@dotnet-policy-service agree |
src/Http/Http.Extensions/test/Microsoft.AspNetCore.Http.Extensions.Tests.csproj
Show resolved
Hide resolved
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
/azp run |
Commenter does not have sufficient privileges for PR 46898 in repo dotnet/aspnetcore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also references to the AwaitableInfo
API in the OpenAPI-related codepaths we have in OpenApiGenerator
and EndpointMetadataApiDescription
provider. Can we update those too for consistency across the different places?
src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateGeneratorTests.cs
Outdated
Show resolved
Hide resolved
@captainsafia @halter73 when trying to bring this branch up to date with I think there are two options:
Do you have a preference? |
It probably makes sense to make them runtime only. |
Let me know if there's anything else you need from me on this. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
/azp run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll admit to having limited knowledge on the F# front here but the implementation seems sensible and doesn't introduce any breaking changes.
Pipelines were unable to run due to time out waiting for the pull request to finish merging. |
Thanks, @captainsafia! |
Hi @brianrourkeboll. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
Fixes #46773.
Async<'T>
as an awaitable type in minimal APIs endpoints using the sameCoercedAwaitableInfo
helper that is used to provide such support for controller action methods.ObjectMethodExecutorFSharpSupport
implementation so that it can be used both for the existing controller action method scenario as well as for the minimal APIs endpoint scenario.Async<'T>
wherever there were existing tests forTask<TResult>
orValueTask<TResult>
.Async<unit>
1 into void-returning (non-generic)Task
instead ofTask<unit>
.Task<unit>
toTask
andValueTask<unit>
toValueTask
.Footnotes
https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/unit-type ↩