Skip to content

app.UseRouting must be called after UsePathBase #48370

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

Closed
2 of 15 tasks
Rick-Anderson opened this issue May 22, 2023 · 2 comments
Closed
2 of 15 tasks

app.UseRouting must be called after UsePathBase #48370

Rick-Anderson opened this issue May 22, 2023 · 2 comments
Labels
analyzer Indicates an issue which is related to analyzer experience api-suggestion Early API idea and discussion, it is NOT ready for implementation area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Comments

@Rick-Anderson
Copy link
Contributor

Background and Motivation

Although this is documented, many customers hit this problem:

@Tratcher and @halter73 suggest an analyzer in this comment

Proposed Analyzer

The implicit call to UseRouting that WebApplication added at the start of the pipeline configures routing before UsePathBase is called.

Warn when Routing happens before UsePathBase

Analyzer Behavior and Message

Warn when Routing happens before UsePathBase

Link to app.UseRouting

Category

  • Design
  • Documentation
  • Globalization
  • Interoperability
  • Maintainability
  • Naming
  • Performance
  • Reliability
  • Security
  • Style
  • Usage

Severity Level

  • Error
  • Warning
  • Info
  • Hidden

Usage Scenarios

Anytime Routing happens before UsePathBase

Risks

None

@Rick-Anderson Rick-Anderson added api-suggestion Early API idea and discussion, it is NOT ready for implementation analyzer Indicates an issue which is related to analyzer experience labels May 22, 2023
@ghost ghost added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 22, 2023
@BrennanConroy
Copy link
Member

This was fixed in 7.0. Not sure we're going to invest in an analyzer only for 6.0 apps.

@Rick-Anderson
Copy link
Contributor Author

Not worth it for legacy apps. Fixed in 7, 8, ...

@ghost ghost locked as resolved and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
analyzer Indicates an issue which is related to analyzer experience api-suggestion Early API idea and discussion, it is NOT ready for implementation area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

No branches or pull requests

2 participants