InvalidOperationException in NotificationService.Notify #1676

Closed
opened 2026-01-29 17:57:08 +00:00 by claunia · 1 comment
Owner

Originally created by @botondberes on GitHub (Mar 20, 2025).

Describe the bug
Using NotificationService.Notify with the NotificationMessage parameter throws an InvalidOperationException. The overload without NotificationMessage works fine.

To Reproduce
public static void NotifyFromServiceResult(this NotificationService service, DataServiceResult result, double? duration = null)
{
service.Notify(new NotificationMessage
{
Severity = result.Successful ? NotificationSeverity.Success : NotificationSeverity.Error,
Summary = result.Successful ? Constants.UI.Success : Constants.UI.Error,
Detail = result.Message ?? string.Empty,
Duration = duration
});
}
This will fail with an InvalidOperationException in the RadzenNotificationMessage.BuildRenderTree method.

public static void NotifyFromServiceResult(this NotificationService service, DataServiceResult result, double? duration = null)
{
service.Notify(
result.Successful ? NotificationSeverity.Success : NotificationSeverity.Error,
result.Successful ? Constants.UI.Success : Constants.UI.Error,
result.Message ?? string.Empty,
duration ?? 4000);
}
This will not.

I upgraded from 5.6.4 to 6.2.9 when this started happening.
Hope this helps!

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Brave
  • Version 1.76.74
Originally created by @botondberes on GitHub (Mar 20, 2025). **Describe the bug** Using NotificationService.Notify with the NotificationMessage parameter throws an InvalidOperationException. The overload without NotificationMessage works fine. **To Reproduce** public static void NotifyFromServiceResult<T>(this NotificationService service, DataServiceResult<T> result, double? duration = null) { service.Notify(new NotificationMessage { Severity = result.Successful ? NotificationSeverity.Success : NotificationSeverity.Error, Summary = result.Successful ? Constants.UI.Success : Constants.UI.Error, Detail = result.Message ?? string.Empty, Duration = duration }); } This will fail with an InvalidOperationException in the RadzenNotificationMessage.BuildRenderTree method. public static void NotifyFromServiceResult<T>(this NotificationService service, DataServiceResult<T> result, double? duration = null) { service.Notify( result.Successful ? NotificationSeverity.Success : NotificationSeverity.Error, result.Successful ? Constants.UI.Success : Constants.UI.Error, result.Message ?? string.Empty, duration ?? 4000); } This will not. I upgraded from 5.6.4 to 6.2.9 when this started happening. Hope this helps! **Desktop (please complete the following information):** - OS: Windows 11 - Browser Brave - Version 1.76.74
Author
Owner

@enchev commented on GitHub (Mar 21, 2025):

I'm unable to reproduce any exception using this code:

Image

Image

@enchev commented on GitHub (Mar 21, 2025): I'm unable to reproduce any exception using this code: ![Image](https://github.com/user-attachments/assets/818c67b3-9fc9-41ea-81e4-60e8b7967e31) ![Image](https://github.com/user-attachments/assets/b979278a-814c-4ecb-a736-f0e84dd0b78a)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1676