Skip to content

Support late bound results #34300

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

Merged
merged 3 commits into from
Jul 13, 2021
Merged

Conversation

davidfowl
Copy link
Member

@davidfowl davidfowl commented Jul 13, 2021

  • Add support for object, Task<object> and ValueTask<object> result types. We can detect that pattern and generate calls into a helper that does a bunch of runtime checks for known result types.
  • We don't support Task<?> or ValueTask<?>. the result will be a JSON serialized Task<T> and ValueTask<T>
  • Added tests

Fixes #34247

- Add support for object, Task<object> and ValueTask<object> result types. We can detect that pattern and genererate calls into a helper that does a bunch of runtime checks for known result types.
- Added tests
Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well remove the // TODO: Handle custom awaitables comment 😄

@halter73
Copy link
Member

Should we treat object return values as void response types in the EndpointMetadataApiDescriptionProvider now?

// Can't determine anything about IResults yet that's not from extra metadata. IResult<T> could help here.
if (typeof(IResult).IsAssignableFrom(responseType))
{
responseType = typeof(void);
}

@davidfowl
Copy link
Member Author

Should we treat object return values as void response types in the EndpointMetadataApiDescriptionProvider now?

Yes

@davidfowl
Copy link
Member Author

Though I wonder what happens if you leave it as object. I'll check.

- Remove unwrapping and gotos for consistency with static return types
@davidfowl
Copy link
Member Author

Might as well remove the // TODO: Handle custom awaitables comment 😄

We still need to do this for F#

@davidfowl davidfowl enabled auto-merge (squash) July 13, 2021 18:02
@davidfowl davidfowl merged commit f24c70e into main Jul 13, 2021
@davidfowl davidfowl deleted the davidfowl/support-latebound-results branch July 13, 2021 19:06
@ghost ghost added this to the 6.0-preview7 milestone Jul 13, 2021
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
3 participants