We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Closing a dialog that was opened from a menu selection results in ArgumentOutOfRangeException

Performing the following steps results in an ArgumentOutOfRangeException:

  1. Open hamburger menu and select "Item" -> dialog opens
  2. Close the dialog
  3. Repeat steps 1 and 2
Here is the code:



        <SfMenu @ref="HamburgerMenuObj"





                <MenuItem Text="Item"></MenuItem>


            <MenuEvents TValue="MenuItem" ItemSelected="MenuItemSelected"></MenuEvents>


        <DropDownButtonEvents Opened="MenuOpened"></DropDownButtonEvents>



<SfDialog ShowCloseIcon="true" IsModal="true" @bind-Visible="@IsVisible"></SfDialog>

@code {

    protected SfMenu<MenuItem>? HamburgerMenuObj { get; set; }

    protected bool IsVisible;

    protected async Task MenuOpened()


        await HamburgerMenuObj.OpenAsync();


    protected async Task MenuItemSelected(MenuEventArgs<MenuItem> args)


        IsVisible = true;

        if (HamburgerMenuObj is not null) await HamburgerMenuObj.CloseAsync();




    .e-menu-container.e-hamburger .e-menu-header:not(.e-vertical) {

        display: none;


    .e-menu-container.e-hamburger {

        width: 300px;



3 Replies

YA YuvanShankar Arunagiri Syncfusion Team March 2, 2023 10:07 AM UTC

Hi Dave,

We have checked your reported query and to resolve this issue, kindly use the below code snippet.

protected async Task MenuItemSelected(MenuEventArgs<MenuItem> args)


        IsVisible = true;

        if (HamburgerMenuObj is not null) await HamburgerMenuObj.CloseAsync();



The Dropdown Button popup not closed properly in your sample, using the Toggle method of Dropdown Button we can close the dropdown popup along with the menu component.

Check with attached sample code file and get back to use if you need any further assistance on this. 


YuvanShankar A

Attachment: Index_f7e216f.zip

DA Dave March 2, 2023 11:52 PM UTC

That solved the problem. Thank you for your help.

YA YuvanShankar Arunagiri Syncfusion Team March 3, 2023 04:59 AM UTC

You are welcome, Dave. Please get back to us if you need any further assistance on this.

If that post is helpful, please consider accepting it as the solution so that other members can locate it more quickly.

Live Chat Icon For mobile
Up arrow icon