In .NET 8 / 9 ASP.NET Razor Class Library (RCL) views that use "partial" tag helper won't render nested views when referenced from ASP.NET Razor Pages app #55710
I already reported this in #51364 but was asked to do so again as it was logged into a branch that is not being worked on anymore. Hopefully this time it will get attention and hopefully be addressed.
When referencing Razor Class Library (RCL) Partial View from ASP.NET Razor Pages app, nested views of RCL are not being rendered when using <partial name="..."> tag helper, but will render just fine when using await Html.PartialAsync(...)
Here is the screenshot that shows the behavior of the test solution that is attached to this issue:
In short, following code:
<h3>This is RCL's Primary Partial rendering nested partial using TagHelper</h3>
@await Html.PartialAsync("_NestedPartial")
and this one:
<h3>This is RCL Primary Partial rendering nested partial using TagHelper</h3>
<partial name="Shared/_NestedPartial.cshtml">
behave differently, when to the best of my understanding they should not. In fact, they behave same way when used directly in Razor Pages web application.
Is there an existing issue for this?
Describe the bug
I already reported this in #51364 but was asked to do so again as it was logged into a branch that is not being worked on anymore. Hopefully this time it will get attention and hopefully be addressed.
When referencing Razor Class Library (RCL) Partial View from ASP.NET Razor Pages app, nested views of RCL are not being rendered when using
<partial name="...">
tag helper, but will render just fine when usingawait Html.PartialAsync(...)
Here is the screenshot that shows the behavior of the test solution that is attached to this issue:
In short, following code:
and this one:
behave differently, when to the best of my understanding they should not. In fact, they behave same way when used directly in Razor Pages web application.
Expected Behavior
According to the documentation (https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/partial-tag-helper?view=aspnetcore-8.0) the Partial Tag Helper
<partial>
and the HTML Helper options for rendering a partial view@await Html.PartialAsync
should behave the same.Steps To Reproduce
Use following sample solution to see the behavior: Razor Class Library Bug.zip
Exceptions (if any)
No response
.NET Version
9.0.100-preview.3.24204.13
Anything else?
No response