Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding attributes and classes in TagHelper DropDownList causes NullReferenceException when runtime compilation is enabled #8068

Open
kendo-bot opened this issue Nov 29, 2024 · 0 comments
Assignees
Labels
Bug C: DropDownList FP: Unplanned Sync status with associated Feedback Item Regression Broken functionality which was working previously S: Wrappers (ASP.NET Core)

Comments

@kendo-bot
Copy link
Contributor

kendo-bot commented Nov 29, 2024

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

  1. Create a .NET 8 project and install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation NuGet package.

  2. Define a TagHelper DropDownList and add a custom class:

//Program.cs
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();

builder.Services.AddMvc().AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);
builder.Services.AddKendo();

//View

<kendo-dropdownlist for="Id" datatextfield="Text" datavaluefield="Value" auto-width="true" class="form-control w-75">
    <datasource type="Kendo.Mvc.UI.DataSourceTagHelperType.Ajax">
        <transport>
            <read url="@Url.Action("GetData", "Home")"/>
        </transport>
    </datasource>
</kendo-dropdownlist>
  1. Run the application and observe the exception: "NullReferenceException: Object reference not set to an instance of an object."

  2. 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

  • **Telerik UI for ASP.NET Core version: 2024.4.1112
  • **Browser: [all]
@kendo-bot kendo-bot added the FP: Unplanned Sync status with associated Feedback Item label Nov 29, 2024
@mihaela-lukanova mihaela-lukanova added Bug C: DropDownList S: Wrappers (ASP.NET Core) Regression Broken functionality which was working previously labels Nov 29, 2024
@mihaela-lukanova mihaela-lukanova self-assigned this Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug C: DropDownList FP: Unplanned Sync status with associated Feedback Item Regression Broken functionality which was working previously S: Wrappers (ASP.NET Core)
Projects
None yet
Development

No branches or pull requests

2 participants