You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For more NativeAOT size savings, we can avoid preserving all type information for methods pointed to by delegates if we enable this. See dotnet/runtime#96166 (comment) for more details.
We essentially need to add another thunk here to allow resolution of MethodInfo from the delegate when using RDG (the request delegate generator).
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
The PR contains changes to the reference-assembly that describe the API change. Or, you have included a snippet of reference-assembly-style code that illustrates the API change.
The PR describes the impact to users, both positive (useful new APIs) and negative (breaking changes).
Someone is assigned to "champion" this change in the meeting, and they understand the impact and design of the change.
We were trying to avoid any binary breaks on principle, but I think it could actually matter if you had RDG endpoints compiled against .NET 8 running on .NET 9.
Activity
captainsafia commentedon Jan 5, 2024
Don't you mean RDF here (compile-time generation)?
I think the proposed API would look like this:
jkotas commentedon Jan 5, 2024
Is the whole purpose of the extra argument to provide
routeHandler.Method
? Can the extra argument be MethodInfo instead?davidfowl commentedon Jan 5, 2024
Actually, you're right, we might just be able to pass it in directly 😄
captainsafia commentedon Jan 5, 2024
Correct, indeed. Here's the full API proposal.
Proposed API
namespace Microsoft.AspNetCore.Routing; public static class RouteHandlerServices { public static RouteHandlerBuilder Map( IEndpointRouteBuilder endpoints, string pattern, Delegate handler, IEnumerable<string>? httpMethods, Func<MethodInfo, RequestDelegateFactoryOptions?, RequestDelegateMetadataResult> populateMetadata, Func<Delegate, RequestDelegateFactoryOptions, RequestDelegateMetadataResult?, RequestDelegateResult> createRequestDelegate, + MethodInfo? methodInfo) }
Usage Examples
Example taken from code generated by RDG.
ghost commentedon Jan 5, 2024
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
halter73 commentedon Jan 8, 2024
API Review Notes:
MethodInfo
should not be nullable.API Approved. We have great hopes for how much more we can trim!
davidfowl commentedon Jan 8, 2024
Any reason this isn't an optional parameter?
halter73 commentedon Jan 9, 2024
We were trying to avoid any binary breaks on principle, but I think it could actually matter if you had RDG endpoints compiled against .NET 8 running on .NET 9.
davidfowl commentedon Jan 9, 2024
I thought there was a way to do both, but it's escaping me right now.