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

Re-opening Modal Dialog with Grid having ObservableCollection DataSource throws ArgumentException error

Each time I open the modal dialog containing a Grid, I refresh the grid data. When I close and subsequently re-open the dialog I get the following error:

Uncaught Error Error: System.ArgumentException: There is no tracked object with id '3'. Perhaps the DotNetObjectReference instance was already disposed. (Parameter 'dotNetObjectId')

    at endInvokeDotNetFromJS (https://localhost:44333/_framework/blazor.server.js:1:3700)

    at <anonymous> (https://localhost:44333/_framework/blazor.server.js:1:72054)

    at _invokeClientMethod (https://localhost:44333/_framework/blazor.server.js:1:72040)

    at _processIncomingData (https://localhost:44333/_framework/blazor.server.js:1:70082)

    at connection.onreceive (https://localhost:44333/_framework/blazor.server.js:1:64485)

    at o.onmessage (https://localhost:44333/_framework/blazor.server.js:1:48819)


The following code reproduces the error (Blazor Server, DotNet 6.0):


<SfButton @onclick="OnSelect">Open Dialog</SfButton>


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

    <DialogTemplates>

        <Content>

            <SfGrid DataSource="@Items" />

        </Content>

    </DialogTemplates>

</SfDialog>


@code

{

    private bool _visible;

    public ObservableCollection<ItemModel> Items { get; set; } = new();


    private void OnSelect(MouseEventArgs args)

    {

        UpdateItems();

        _visible = true;

    }


    protected void UpdateItems()

    {

        Items.Clear();

        Items.Add(new ItemModel {Name = "Item1"});

        Items.Add(new ItemModel {Name = "Item2"});

    }


    public class ItemModel

    {

        public string? Name { get; set; }

    }

}


3 Replies

PS Prathap Senthil Syncfusion Team October 11, 2022 10:04 AM

Hi Dave,


Greetings from Syncfusion support.


We have analyzed your query and are facing the issue mentioned on our end in the latest version. we will check and update the further details within three business days.


Until then we appreciate your patience.


Regards,

Prathap S



PS Prathap Senthil Syncfusion Team October 13, 2022 11:06 AM

Hi Dave,

Sorry for the inconvenience caused.

Currently, we are validating your query at our end as a high priority. Further details will be updated on or before 15th October 2022.

Until then we appreciate your patience.

Regards,

Prathap S



PS Prathap Senthil Syncfusion Team October 17, 2022 10:55 AM

Hi Dave,


Thanks for your patience.


We have considered it as a bug and logged an issue  “Re-opening Modal Dialog with Grid having ObservableCollection DataSource throws Argument Exception error” for the same. Thank you for taking the time to report this issue and helping us to improve our product. At Syncfusion, we are committed to fix all validated defects (subject to technological feasibility and Product Development Life Cycle) and this fix will be included in our upcoming patch release which is expected to be rolled out on or before 14th November 2022.


You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.       


https://www.syncfusion.com/feedback/38479/re-opening-modal-dialog-with-grid-having-observablecollection-datasource-throws


Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization”


Until then we appreciate your patience.


Regards,

Prathap S



Loader.
Live Chat Icon For mobile
Up arrow icon