Skip to content

Make-method-async code fix breaks ASP.NET MVC action routing after 'Async' suffix is appended to method name #4849

Closed
@terrajobst

Description

@terrajobst

From @jeremymeng on August 28, 2017 18:31

Version Used:

Steps to Reproduce:

  1. create a ASP.NET Core project
  2. select MVC template, create the project, and F5 to make sure the home page is shown
  3. open HomeController.cs
  4. changing return type of Index() to Task<IActionResult>
  5. Add await Task.Delay(1); inside Index()
  6. Invoke code fix to make the method async

Now the method looks like

        public async Task<IActionResult> IndexAsync()
        {
            await Task.Delay(300);
            return View();
        }
  1. F5
    Actual Behavior:
    HTTP 404

if rename the method back to Index() F5 works again.

Copied from original issue: dotnet/roslyn#21770

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbreaking-changeThis issue / pr will introduce a breaking change, when resolved / merged.enhancementThis issue represents an ask for new feature or an enhancement to an existing one

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions