DropDown does not throw errors within an async Task set to the Change parameter. #474

Open
opened 2026-01-29 17:37:54 +00:00 by claunia · 0 comments
Owner

Originally created by @Daeymon on GitHub (Jul 20, 2022).

Describe the bug
Errors within an async method set to the Change EventCallback parameter of the RadzenDropDown do not get thrown back to main thread and therefore do not go through the logger.

To Reproduce
Steps to reproduce the behavior:

  1. Create a default Blazor Server Project with Radzen added as per the Get Started instructions.
  2. Add the following code to the bottom of Index.razor:
<span>This component correctly throws an error in the async OnChange method.</span>
<RadzenNumeric TValue=int Change=this.OnChangeAsync />

<span>This component does not correctly throw the error in the async OnChange method.</span>
<RadzenDropDown TValue=string Data=this.Values Change=this.OnChangeAsync />

@code {
    public string[] Values = { "Yes", "No" };

    public async Task OnChangeAsync()
    {
        throw new InvalidOperationException("This is an error");
        await Task.CompletedTask;
    }
}
  1. Changing a value on the RadzenNumeric will throw an error as one would expect. This one is there to show expected behaviour. Changing a value on the RadzenDropdown will do nothing within the application. The only evidence of the error will be a line in the debug console.

Expected behavior
Expected behaviour is what happens when changing the value in the RadzenNumeric in the above code.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version: 103.0.5060.114
Originally created by @Daeymon on GitHub (Jul 20, 2022). **Describe the bug** Errors within an async method set to the Change EventCallback parameter of the RadzenDropDown do not get thrown back to main thread and therefore do not go through the logger. **To Reproduce** Steps to reproduce the behavior: 1. Create a default Blazor Server Project with Radzen added as per the Get Started instructions. 2. Add the following code to the bottom of Index.razor: ``` <span>This component correctly throws an error in the async OnChange method.</span> <RadzenNumeric TValue=int Change=this.OnChangeAsync /> <span>This component does not correctly throw the error in the async OnChange method.</span> <RadzenDropDown TValue=string Data=this.Values Change=this.OnChangeAsync /> @code { public string[] Values = { "Yes", "No" }; public async Task OnChangeAsync() { throw new InvalidOperationException("This is an error"); await Task.CompletedTask; } } ``` 3. Changing a value on the RadzenNumeric will throw an error as one would expect. This one is there to show expected behaviour. Changing a value on the RadzenDropdown will do nothing within the application. The only evidence of the error will be a line in the debug console. **Expected behavior** Expected behaviour is what happens when changing the value in the RadzenNumeric in the above code. **Desktop (please complete the following information):** - OS: Windows 10 - Browser: Chrome - Version: 103.0.5060.114
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#474