Splitbutton Click nulllability issues with RadzenSplitButtonItem #1287

Closed
opened 2026-01-29 17:51:39 +00:00 by claunia · 3 comments
Owner

Originally created by @NEmbgen on GitHub (Jul 8, 2024).

Describe the bug

Using the SplitButton component creates an IDE issue with nullability checks, as the EventCallback for Click (here) suggests it returns a non-nullable RadzenSplitButtonItem. If the main Button is clicked however null is returned (here)

This creates an issue where you need to do a null check but your IDE is warning you about an unnecessary null check.

To Reproduce

  • Create a splitbutton and an event callback for Click
  • The event callback will have the signature public void OnClick(RadzenSplitButtonItem item)
  • In the event callback access item.Value
  • Click the main part of the button (not the dropdown)

Expected behavior
Return a nullable RadzenSplitButtonItem via RadzenSplitButtonItem?

Originally created by @NEmbgen on GitHub (Jul 8, 2024). **Describe the bug** Using the `SplitButton` component creates an IDE issue with nullability checks, as the `EventCallback` for `Click` ([here](https://github.com/radzenhq/radzen-blazor/blob/e466de4d0e61c9d3a355a9d7f8b8b1d2c7cd8938/Radzen.Blazor/RadzenSplitButton.razor.cs#L153)) suggests it returns a non-nullable `RadzenSplitButtonItem`. If the main Button is clicked however `null` is returned ([here](https://github.com/radzenhq/radzen-blazor/blob/e466de4d0e61c9d3a355a9d7f8b8b1d2c7cd8938/Radzen.Blazor/RadzenSplitButton.razor.cs#L170)) This creates an issue where you need to do a null check but your IDE is warning you about an unnecessary null check. **To Reproduce** - Create a splitbutton and an event callback for `Click` - The event callback will have the signature `public void OnClick(RadzenSplitButtonItem item)` - In the event callback access `item.Value` - Click the main part of the button (not the dropdown) **Expected behavior** Return a nullable `RadzenSplitButtonItem` via `RadzenSplitButtonItem?`
Author
Owner

@akorchev commented on GitHub (Jul 8, 2024):

Hi @NEmbgen,

You can add the ? yourself.

@akorchev commented on GitHub (Jul 8, 2024): Hi @NEmbgen, You can add the `?` yourself.
Author
Owner

@NEmbgen commented on GitHub (Jul 8, 2024):

@akorchev Thanks for the response. I know I can add it myself, but wouldn't it be more correct from an API point of view for Radzen to have it?

@NEmbgen commented on GitHub (Jul 8, 2024): @akorchev Thanks for the response. I know I can add it myself, but wouldn't it be more correct from an API point of view for Radzen to have it?
Author
Owner

@akorchev commented on GitHub (Jul 8, 2024):

Currently null checks are not enabled for the Radzen.Blazor project. Enabling them would require a huge effort which we are not willing to make at the moment.

@akorchev commented on GitHub (Jul 8, 2024): Currently null checks are not enabled for the Radzen.Blazor project. Enabling them would require a huge effort which we are not willing to make at the moment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1287