-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
As described in my comment in: #44599
When calling UseRouting() in IStartupFilter, it will not see endpoints mapped by WebApplication.MapControllers().
// Presume this is nuget
class FooStartupFilter: IStartupFilter {
public Action<IApplicationBuilder> Configure(Action<IApplicationBuilder> next)
=> builder => {
builder.UseRouting();
builder.Use(next => ctx => {
// do something with Endpoint.
});
next(builder);
}
}
var builder = ....; // get WebApplicationBuilder
builder.Services.AddTransient<IStarutpFilter, FooStartupFilter>();
var webApplication = builder.Build();
webApplication .MapControllers();
Second middleware in IStartupFilter will not see any endpoints unless UseEndpoints(e => e.MapControllers()) is added.
Expected Behavior
UseRouting in IStartupFilter should be able to access mapped routes that were mapped on WebAppliaction and vice versa.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
No response
Anything else?
Most likely caused by WebApplicationBuilder.cs:395.
Metadata
Metadata
Assignees
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc