Skip to content

Router.PreferExactMatches ends up limiting trimming unnecessarilyย #29913

Closed
@stephentoub

Description

@stephentoub

Router.PreferExactMatches has this comment on it:

/// Important: all applications should explicitly set this to true. The option to set it to false
/// (or leave unset, which defaults to false) is only provided for backward compatibility.
/// In .NET 6, this option will be removed and the router will always prefer exact matches.

As of now, though, the option is still available and still false by default. The net effect is the "LegacyRoute" support constructed here:

Routes = PreferExactMatches
? RouteTableFactory.Create(assemblies)
: LegacyRouteTableFactory.Create(assemblies);

ends of referencing and preventing a bunch of APIs that could otherwise by trimmed by the linker from getting trimmed in a default Blazor wasm app.

cc: @eerhardt, @javiercn

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected-mostThis issue impacts most of the customersarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.linker-friendlinessTracking linker friendlinessseverity-minorThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions