Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router.PreferExactMatches ends up limiting trimming unnecessarily #29913

Closed
stephentoub opened this issue Feb 4, 2021 · 5 comments · Fixed by #31295
Closed

Router.PreferExactMatches ends up limiting trimming unnecessarily #29913

stephentoub opened this issue Feb 4, 2021 · 5 comments · Fixed by #31295
Labels
affected-most This issue impacts most of the customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. linker-friendliness Tracking linker friendliness severity-minor This label is used by an internal tool
Milestone

Comments

@stephentoub
Copy link
Member

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

@pranavkm pranavkm added area-blazor Includes: Blazor, Razor Components linker-friendliness Tracking linker friendliness labels Feb 4, 2021
@javiercn javiercn added this to the Next sprint planning milestone Feb 5, 2021
@ghost
Copy link

ghost commented Feb 5, 2021

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@SteveSandersonMS SteveSandersonMS added affected-most This issue impacts most of the customers bug This issue describes a behavior which is not expected - a bug. severity-minor This label is used by an internal tool labels Feb 19, 2021 — with ASP.NET Core Issue Ranking
@pranavkm
Copy link
Contributor

@SteveSandersonMS / @javiercn, what's our plan for this? If we want to remove legacy routing (I'd be open to it), we should do it right away. If we want to wait until 7.0 to remove legacy routing, we should consider enabling legacy routing behind a feature switch so that we have the ability to trim it away.

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Mar 30, 2021

If possible it would be great to drop the legacy code paths ASAP. If we get any signs of dissatisfaction, we could ship the legacy router OOB in a separate package.

Of course it would need to be announced as a breaking change.

@pranavkm
Copy link
Contributor

Cool. I have a PR out for it - #31295 - that's part of my no-linq work. Let me see if I can separate the two since they're not really dependent.

@stephentoub
Copy link
Member Author

Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators May 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-most This issue impacts most of the customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. linker-friendliness Tracking linker friendliness severity-minor This label is used by an internal tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants