GridViewSynchronizationService Reference Disposed Object...

9 posts, 0 answers
  1. curtis
    curtis avatar
    2 posts
    Member since:
    Aug 2012

    Posted 17 Jun 2012 Link to this post

    Hey Everyone,

    I am having an issue regarding the GridViewSynchronizationService trying to reference an object that has been disposed. Here is what I am doing ... I have a form with a grid on it. The user double clicks an entry in the grid, then the id column from the grid is stored into a variable and then passed as a reference to a form that is being opened. As soon as the form opens, the requesting form disposes itself. Upon disposing I receive the following error: Cannot access a disposed object. Object name: 'GridViewSynchronizationService'.

    I will attach the code so that you can see what is happening. I have found the only way to avoid this from happening is to add a timer object to the form and have it dispose the form after waiting about 3 seconds, however this simply doesn't feel right.
    using System;
    using System.Linq;
    using System.Windows.Forms;
    using PlantManager.Classes;
     
    namespace PlantManager.Admin.UserManager
    {
        public partial class frmUserManager : Form
        {
            public frmUserManager()
            {
                InitializeComponent();
            }
     
            private void frmUserManager_Load(object sender, EventArgs e)
            {
                LoadData();
            }
     
            private void LoadData()
            {
                QueryAgent qry = new QueryAgent();
                qry.SQLText = "SELECT tbl_Users.UserID,tbl_Users.Username,tbl_Users.FirstName,tbl_Users.LastName,tbl_Users.PhoneExt,tbl_Users.EmailAddress FROM dbo.tbl_Users WHERE tbl_Users.Active = 1";
                qry.exec_SelectQuery();
                dgResults.DataSource = qry.DataSource;
            }
     
            private void mnuEditUser_Click(object sender, EventArgs e)
            {
                EditUser();
            }
     
            private void dgResults_DoubleClick(object sender, EventArgs e)
            {
                EditUser();
            }
     
            private void EditUser()
            {
                string UserID = dgResults.CurrentRow.Cells["UserID"].Value.ToString();
                PubVar.OpenForm("Admin.UserManager.frmEditUser", new string[1] { UserID }, this, true);
                this.Dispose();
            }
        }
    }

  2. curtis
    curtis avatar
    2 posts
    Member since:
    Aug 2012

    Posted 17 Jun 2012 Link to this post

    Here is the code that is used to open the form ... I added the parameters into the constructor for sending a reference to the requesting form and a parameter for whether or not to close the requesting form thinking that it might have been related to the form not fully opening prior to the requesting form being closed, however I still get the error.

    /// <summary>Opens a form with a loading screen.</summary>
     /// <param name="formName">Reference to the form that needs to be opened.</param>
     /// <param name="variables">Reference to variables that need to be passed to opening form.</param>
     /// <param name="RequestingForm"> Form to be closed. Only specify if you want to close the requesting form.</param>
     /// <param name="CloseRequestingForm">Close the requesting form? (true, false)</param>
     public static void OpenForm(string formName, string[] variables, Form RequestingForm, Boolean CloseRequestingForm)
      {
          // Grab the form type.
          Type type = Type.GetType("PlantManager." + formName);
     
          // If form already exists, navigate to it.
          foreach (Form frm in Application.OpenForms)
          {
              if (frm.GetType() == type)
              {
                  frm.Dispose();
              }
          }
     
          OpenLoadingScreen();
     
          try
          {
              object[] argVals = new object[] { variables };
     
              // Create a "Type" array of the variable type.
              Type[] types = new Type[1];
              types[0] = typeof(string[]);
     
              // If the form doesn't exists, create it and navigate to it passing in the variables as argVals.
              Form frm2 = type.GetConstructor(types).Invoke(argVals) as Form;
              frm2.MdiParent = Application.OpenForms["frmMainApp"];
              frm2.Show();
              frm2.WindowState = FormWindowState.Maximized;
          }
     
          catch (Exception exception)
          {
              using (Form newForm = new Form())
              {
                 ErrHandler.HandleException(exception);
              }
          }
     
          CloseLoadingScreen();
          if (CloseRequestingForm == true)
          {
              RequestingForm.Dispose();
          }
      }

  3. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 20 Jun 2012 Link to this post

    Hello Curtis,

    Thank you for writing.

    This has been logged as issue in our Public Issue Tracking System and can be found on this link. Please check my answer in the support ticket you have opened for additional details.

    Kind regards,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  4. Anders
    Anders avatar
    1 posts
    Member since:
    Oct 2012

    Posted 20 Sep 2014 in reply to Ivan Todorov Link to this post

    Hi, what was the solution to this post? I am getting the same error.

    I am setting the value of a filterdescription which haven't been a problem so far. I am using Winforms Q3 2013

    Regards
    Anders
  5. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 23 Sep 2014 Link to this post

    Hello Anders,

    Here is the link to the same item in our feedback portal: http://feedback.telerik.com/Project/154/Feedback/Details/111465-fix-an-exception-is-thrown-by-radgridview-if-you-dispose-it-on-some-of-its-mouse. The item status is completed and it is scheduled for the upcoming Q3 2014 release, which should be out before the end of October. 

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Robert
    Robert avatar
    5 posts
    Member since:
    Mar 2015

    Posted 13 Apr 2017 Link to this post

    Hey,

     

    I'm encountering an error very similar to this one.

     

    I have a form that contains a radGrid, there is a link from this form to another form.

     

    Once an action has been completed on the second form, it feeds information back to the first form which tries to update information on the radGrid.

     

    At this point the ragGrid (and entire form for that matter) have become disposed, leading to this error.

     

    I'm not sure how to proceed?

     

    Thanks,

    Robert

  7. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3530 posts

    Posted 13 Apr 2017 Link to this post

    Hello Robert, 

    Thank you for writing.  

    Following the provided information, I was unable to reproduce the issue you are facing with the latest version. I have attached my sample project. Could you please specify the exact steps how to reproduce the problem? Alternatively, feel free to submit a support ticket and provide a sample project demonstrating the problem. This would be the fastest way to make an adequate analysis of the problem and assist you further. Thank you in advance. 

    I am looking forward to your reply.

     Regards,
    Dess
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  8. kwaku
    kwaku avatar
    2 posts
    Member since:
    Aug 2017

    Posted 15 Aug 2017 Link to this post

    Please I'm having similar issue. I get similar error -"Cannot access disposed object. Object name:GridviewSynchronizationService" when trying to open form in designer view. I don't know where the error is coming from. What should I do?
  9. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3530 posts

    Posted 16 Aug 2017 Link to this post

    Hello , 

    Thank you for writing.  

    The provided information is not enough for me to replicate the issue locally. If it is a design time problem, I would like to ask you to carefully check the references to all Telerik controls in your project and make sure that they are the same version considering the suffix as well (.20 or .40). Better yet, you can remove all references and add them anew by using the DLLs from your last installation. Delete the license.licx file. After that, you should rebuild your project, close Visual Studio and open it again to make sure that no references are kept in the memory by Visual Studio. 

    If you are still experiencing any further difficulties, feel free to submit a support ticket where you can provide additional details and a sample project demonstrating the exact error that you are facing.

    I hope this information helps. 

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top