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; }

    }

}


5 Replies

PS Prathap Senthil Syncfusion Team October 11, 2022 03:04 PM UTC

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 04:06 PM UTC

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 03:55 PM UTC

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




MS Monisha Saravanan Syncfusion Team December 15, 2022 09:28 AM UTC

Hi Dave,


Due to some unforeseen circumstances, we could not able to include the fix for the issue in our latest release. We have planned to implement this in our upcoming patch release which is going to be held on 28th December 2022.


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.


We will update you once the release is rolled out. Until then we appreciate your patience.




MS Monisha Saravanan Syncfusion Team December 30, 2022 11:04 AM UTC

Hi Dave,


We are glad to announce that, we have included fix for the issue “Re-opening Modal Dialog with Grid having ObservableCollection DataSource throws Argument Exception errorin our release (20.4.0.41).  So please upgrade to our latest version of Syncfusion NuGet package to resolve the reported issue. Please find the Nuget package for latest fixes and features from below.


Nuget : https://www.nuget.org/packages/Syncfusion.Blazor.Grid


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 


Please let us know if you have any concerns.


Loader.
Live Chat Icon For mobile
Up arrow icon