MVC Inspection on route

The MVC Inspection gives a warning when an action is not found:

 return LocalRedirect(Url.Action("klaar", "Base"));

This is useful, but it does not take in to account routing.

The above does not generate a warning when an action exists like:

[HttpGet]

public async Task<IActionResult> Klaar() {...}

But it generates an error warning when the route is set like this:

[HttpGet]
[Route("klaar")]
[Route("finished")]
public async Task<IActionResult> Finished() {...}

The error warning is incorrect, as the statement is completely legit: it redirects to Url: http(s)://domain.com/klaar and hits the controller at the Finished() method as expected.

I am using these double routes to have local language routes.

1

Please sign in to leave a comment.