Description
I beleive this could possibly be related to #16579. We're using ASP.Net Core 3.1 LTS with MVC Controllers and have set of static routes plus a whole lot of dynamic routes for categories, products and other slug styles (driven by an inmemory cache of some database view).. milliseconds are important on our GET pipeline so we noticed something odd but not breaking as the correct route is eventually resolved.
If I wire up a simple scenario of match homepage, and a DynamicRouteValueTransformer that has a big cache from a database to decide which controller/action to select, then I expect only the match for the homepage to be hit when I GET ?, but instead it goes through TransformAsync on RouteResolver too (with no routevalues set) - whilst it works it seems inefficient and adds several milliseconds to our request processing.
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/", async context =>
{
await context.Response.WriteAsync("Homepage");
});
//HomeController.MapRoutes(endpoints);
endpoints.MapDynamicControllerRoute<RouteResolver>("/{**path}");
// ContentController.MapRoutes(endpoints);
});
Scenario: GET /
Expected: TransformAsync on RouteResolve not to be called.
Actual: TransformAsync on RouteResolve is needlessly called.