DialogService

Why is the _dialogService.OpenAsync not awaited?

private async Task AddClick(MouseEventArgs e)
{
    var newCustomer = new Customer();

    var dialogResult = await _dialogService.OpenAsync<CustomerDialog>($"Create",
        new Dictionary<string, object>() { { "Customer", newCustomer } },
        new DialogOptions() { Width = "750px", Height = "Auto" });

    if (IsOkPressed(dialogResult))
    {
        await _customerFactory.CreateCustomer(newCustomer);
        await _customerFactory.RefreshCustomers();
    }
}

If hooking up to the events
_dialogService.OnOpen += Open;
_dialogService.OnClose += Close;

I can see that I get an close event when the dialog is shown and a second one when the dialog is closed.

The dialog is awaited. You can debug your application to see for yourself.

As you can see the code is awaited but I was asking why it does not work. I do get 2 close events. The dialog is not waiting for me to press Ok or Cancel.

We haven't seen such a problem before. Can you reproduce this issue on our online demo? Alternatively if you have a Radzen Professional subscription you can send us a your project to info@radzen.com

Found that when AddClick method is called from a NavLink like this
<NavLink class="nav-link" href="#" @onclick="@EditClick">.

Then I get this behavior. When using Radzen Click event it works just fine.

Sorry for that. Now it works :slight_smile: