-
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
[AOT] Add expression free request filter pipeline for RequestDelegate #46020
Conversation
5a9c74b
to
690b124
Compare
Numbers!
Test app: var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", (HttpContext c) => Task.CompletedTask);
app.Run(); Good news is There are two after results. I noticed that the hack to get the empty HTTP result brought in a lot of A simple fix could be to move EmptyHttpResult to |
I think we should move empty result down as well |
@JamesNK typo in the numbers? Should those have a decimal point in them somewhere or just be bytes instead if MB? |
Ah, yeah, KB |
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.
This looks good to me, but I'm definitely no expert in this area.
MethodInfo = requestDelegate.Method, | ||
ApplicationServices = options.EndpointBuilder.ApplicationServices | ||
}; | ||
var jsonTypeInfo = (JsonTypeInfo<object>)jsonSerializerOptions.GetReadOnlyTypeInfo(typeof(object)); |
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.
How does this work with source generation, if we always get the JsonTypeInfo for object
?
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 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.
This is weird, but OK I guess.
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.
Very weird.
Co-authored-by: Eric Erhardt <[email protected]>
Fixes #46014
The goal here is to remove
System.Linq.Expressions
dependency from mappingRequestDelegate
endpoints (i.e. basic, non-minimal API endpoints). This allows apps that map basic endpoints to avoid warnings from expressions, and reduce publish size by trimming away expressions assembly.Changes:
InferMetadataFunc
andCreateHandlerRequestDelegateFunc
toRouteEntry
.RequestDelegate
now registers its own func for building request filter factory pipeline. It doesn't useSystem.Linq.Expressions
.RequestDelegate
routes lives inMicrosoft.AspNetCore.Routing
. All ofRequestDelegateFactory
lives inMicrosoft.AspNetCore.Http.Extensions
. I tried to share code using source file linking, but a cleaner solution would be to add a publicRequestDelegateFactory.Create(RequestDelegate, ...)
overload thatMicrosoft.AspNetCore.Routing
can call. Thoughts? Edit: API proposal - [API] RequestDelegateFactory.Create RequestDelegate overload #46024@halter73 @davidfowl This is a start to the changes you discussed making. The next step after this PR is to make public API to configure
InferMetadataFunc
andCreateHandlerRequestDelegateFunc
. Then source generated code can inject its own logic.