Skip to content

The "pattern" paramter of Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapFallback is ignored when EnableRequestDelegateGenerator is true #65992

Closed

Description

@johanpolson

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The pattern paramter of Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapFallback is ignored when EnableRequestDelegateGenerator is true

This means that the following code only works when EnableRequestDelegateGenerator is set to false

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapFallback("{*path}", (HttpContext context) => "this is {*path}");
app.MapFallback("{*path:nonfile}", (HttpContext context) => "this is {*path:nonfile}");

app.Run();

but if I run the code with EnableRequestDelegateGenerator set to true 😥

Connection id "0HNKBFUONIV8B", Request id "0HNKBFUONIV8B:00000003": An unhandled exception was thrown by the application.
Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints. Matches:

{*path:nonfile}
{*path:nonfile}
           at Microsoft.AspNetCore.Routing.Matching.DefaultEndpointSelector.ReportAmbiguity(Span`1 candidateState)

.NET Version

11.0.100-preview.2.26159.112

Activity

  1. added
    area-minimal
    on Mar 26, 2026
  2. added theissue type on Jul 1, 2026
  3. added this to the .NET 11 Planning milestone on Jul 1, 2026
  4. self-assigned this
    on Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

NativeAOTarea-minimalfeature-rdg

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions