Adding attributes and classes in TagHelper DropDownList causes NullReferenceException when runtime compilation is enabled #8068
Labels
Bug
C: DropDownList
FP: Unplanned
Sync status with associated Feedback Item
Regression
Broken functionality which was working previously
S: Wrappers (ASP.NET Core)
Bug report
When the project is configured for runtime compilation, and the TagHelper DropDownList has custom classes or attributes, NullReferenceException is thrown.
Reproduction of the problem
Create a .NET 8 project and install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package.
Define a TagHelper DropDownList and add a custom class:
Run the application and observe the exception: "NullReferenceException: Object reference not set to an instance of an object."
When using the HtmlHelper version of the DropDownList or removing the custom class from the TagHelper declaration, the error does not occur.
Expected/desired behavior
The TagHelper DropDownList must exhibit the same behavior as the HtmlHelper DropDownList.
Environment
The text was updated successfully, but these errors were encountered: