In Razor Class Library (RCL) views that use "partial" tag helper won't render nested views when referenced from ASP.NET Razor Pages app
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
When referencing Razor Class Library (RCL) Partial View from ASP.NET Razor Pages app, nested views of RCL are not being rendered when using `` 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:
```
This is RCL's Primary Partial rendering nested partial using TagHelper
@await Html.PartialAsync("_NestedPartial")
```
and this one:
```
This is RCL Primary Partial rendering nested partial using TagHelper
```
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.
This was tested with .NET 7 and .NET 8 RC2.
[WebApplication1.zip](https://github.com/dotnet/aspnetcore/files/12897993/WebApplication1.zip)
### 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 `` and the HTML Helper options for rendering a partial view `@await Html.PartialAsync` should behave the same.
### Steps To Reproduce
Use attached sample solution to see the behavior.
[WebApplication1.zip](https://github.com/dotnet/aspnetcore/files/12897993/WebApplication1.zip)
### Exceptions (if any)
_No response_
### .NET Version
.NET 8 RC2
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.