-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesquestion
Milestone
Description
Describe the bug
After updating to Microsoft.AspNetCore.(Mvc) packages from version 2.1.2 to 2.2.0 some of the urls produced with HtmlHelper ActionLink no longer build the correct link using Route attribute
To Reproduce
Steps to reproduce the behavior:
- Create an AspNetCore.Mvc project with the following code
Controller
public IActionResult Index()
{
return View();
}
[Route("{firstInt:int}/{secondInt:int?}")]
public IActionResult Test(int firstInteger, int? secondInteger)
{
return View("Index");
}
View
@Html.ActionLink("CorrectLink", "Test", "Home", new { firstInt = 1, secondInt = 2, boolean = true })
@Html.ActionLink("WrongLink", "Test", "Home", new { firstInt = 1, secondInt = (int?)null, boolean = true })
Package versions with the expected behaviour
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.2" />
</ItemGroup>
Package versions with the incorrect behaviour
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
</ItemGroup>
Expected behavior
A clear and concise description of what you expected to happen.
Links should go to [host]/1/2?boolean=True and [host]/1?boolean=True respectively, but instead go to [host]/1/2?boolean=True and [host]/Home/Test?firstInt=1&boolean=True
Metadata
Metadata
Assignees
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesquestion