Skip to content

Add warning for the reserved route parameter names in ASP.NET routes #79893

@shmutalov

Description

@shmutalov

Brief description:

Add the compiler warning for using reserved route parameter names in ASP.NET routes

Languages applicable:

Both

Code example that the analyzer should report:

[HttpGet]
[Route("/api/actions/{action}/apply")]
public IActionResult ApplyAction(string action)
{
    return Ok();
}

Additional information:

The current behavior returns an HTTP 404 error when using reserved keywords (action, controller, etc.) as route parameters. The runtime doesn't indicate why the route fails to map to the controller's method - it simply returns 404. It would be helpful if the IDE could render wavy underlines with a warning when reserved keywords are used as route parameter names, preventing this hard-to-debug issue at design time.

Documentation requirements:

When this analyzer is implemented, it must be documented by following the steps at Documentation for IDE CodeStyle analyzers.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions