MultiColumnComboBox cannot access disposed object after erasing text and SelectedValueChanged event

Hi,

I'm currently working on a form in which the datagridview cell takes it's input from the multicolumncombobox and everything works fine until I erase the multicolumncombobox's textbox and then select something else


In short this is the sequence I follow

I erase the textbox -> I select a new value from the combobox(SelectedValueChanged event) -> an exception is thrown (Unhandled Exception despite being in a try/catch block)

This is the exception

Exception.png

This is the message associated with it

See the end of this message for details on invoking


just-in-time (JIT) debugging instead of this dialog box.




************** Exception Text **************


System.ObjectDisposedException: Cannot access a disposed object.


Object name: 'ComboBoxPopupContainer'.


   at System.Windows.Forms.Control.CreateHandle()


   at System.Windows.Forms.Control.get_Handle()


   at System.Windows.Forms.Control.PointToClientInternal(Point p)


   at System.Windows.Forms.Control.PointToClient(Point p)


   at Syncfusion.Windows.Forms.Tools.ComboDropDown.ComboDropDown_Deactivate(Object sender, EventArgs e)


   at System.Windows.Forms.Form.OnDeactivate(EventArgs e)


   at System.Windows.Forms.Form.set_Active(Boolean value)


   at System.Windows.Forms.Form.DeactivateMdiChild()


   at System.Windows.Forms.Form.WmMdiActivate(Message& m)


   at System.Windows.Forms.Form.WndProc(Message& m)


   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)


   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)


   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)






************** Loaded Assemblies **************


mscorlib


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4470.0 built by: NET48REL1LAST_C


    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll


----------------------------------------


MDIForm


    Assembly Version: 1.0.0.0


    Win32 Version: 1.0.0.0


    CodeBase: file:///D:/Project/bsp_winforms/bsp_winforms/bin/Debug/MDIForm.exe


----------------------------------------


Syncfusion.Licensing


    Assembly Version: 19.4460.0.53


    Win32 Version: 19.4460.0.53


    CodeBase: file:///D:/Project/bsp_winforms/bsp_winforms/bin/Debug/Syncfusion.Licensing.DLL


----------------------------------------


System.Windows.Forms


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4400.0 built by: NET48REL1LAST_C


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll


----------------------------------------


System


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4360.0 built by: NET48REL1LAST_C


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll


----------------------------------------


System.Drawing


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4390.0 built by: NET48REL1LAST_C


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll


----------------------------------------


Syncfusion.Shared.Base


    Assembly Version: 19.4460.0.53


    Win32 Version: 19.4460.0.53


    CodeBase: file:///D:/Project/bsp_winforms/bsp_winforms/bin/Debug/Syncfusion.Shared.Base.DLL


----------------------------------------


System.Xml


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4084.0 built by: NET48REL1


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll


----------------------------------------


System.Configuration


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll


----------------------------------------


System.Core


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4470.0 built by: NET48REL1LAST_C


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll


----------------------------------------


Syncfusion.Tools.Windows


    Assembly Version: 19.4460.0.53


    Win32 Version: 19.4460.0.53


    CodeBase: file:///D:/Project/bsp_winforms/bsp_winforms/bin/Debug/Syncfusion.Tools.Windows.DLL


----------------------------------------


Syncfusion.Grid.Windows


    Assembly Version: 19.4460.0.53


    Win32 Version: 19.4460.0.53


    CodeBase: file:///D:/Project/bsp_winforms/bsp_winforms/bin/Debug/Syncfusion.Grid.Windows.DLL


----------------------------------------


Accessibility


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4084.0 built by: NET48REL1


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll


----------------------------------------


System.Data


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4455.0 built by: NET48REL1LAST_C


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll


----------------------------------------


System.Numerics


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4084.0 built by: NET48REL1


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll


----------------------------------------


UIAutomationProvider


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4470.0 built by: NET48REL1LAST_C


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/UIAutomationProvider/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationProvider.dll


----------------------------------------


WindowsBase


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4470.0 built by: NET48REL1LAST_C


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll


----------------------------------------


UIAutomationTypes


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4470.0 built by: NET48REL1LAST_C


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/UIAutomationTypes/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationTypes.dll


----------------------------------------


System.Runtime.Serialization.Formatters.Soap


    Assembly Version: 4.0.0.0


    Win32 Version: 4.8.4084.0 built by: NET48REL1


    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization.Formatters.Soap/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.Serialization.Formatters.Soap.dll


----------------------------------------




************** JIT Debugging **************


To enable just-in-time (JIT) debugging, the .config file for this


application or computer (machine.config) must have the


jitDebugging value set in the system.windows.forms section.


The application must also be compiled with debugging


enabled.




For example:




<configuration>


    <system.windows.forms jitDebugging="true" />


</configuration>




When JIT debugging is enabled, any unhandled exception


will be sent to the JIT debugger registered on the computer


rather than be handled by this dialog box.







And if keep clicking "continue" this is the final popup before the application closes





This is the cause

MessageStacktrace.png


I have attached the message (Parameter count mismatch) and stacktrace above

Code

TextChanged event
        private void aliasMulticolcombobox_TextChanged(object sender, EventArgs e)
        {
            //Update Filter here
            //MAYBE DIFFERENT THREADS ARE TRYING TO ACCESS THE SAME COLLECTION
            //Object being accessed at the wrong time?




            try
            {
                aliasMulticolcombobox.SelectedValueChanged += new EventHandler(aliasMulticolcombobox_SelectedValueChanged);
            }


            catch(Exception exception)
            {
                MessageBox.Show(exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }


SelectedValueChanged Event

        private void aliasMulticolcombobox_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                ComboBoxBaseDataBound c = aliasMulticolcombobox as ComboBoxBaseDataBound;


                if (c.SelectedIndex != -1)
                {
                    DataRowView dv = c.Items[c.SelectedIndex] as DataRowView;
                    c.Text = dv.Row[0].ToString();
                    dataGridView1.Rows[currRow].Cells[1].Value = c.Text;
                }
            }






            catch (Exception exception)
            {


                MessageBox.Show(exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);


            }
        }



8 Replies 1 reply marked as answer

AM Ammar March 10, 2022 01:10 PM UTC

No offence but what's the point of these community forums if nobody here is going to bother replying?

Maybe because I'm an individual developer with a free license I'm probably not worth the effort I assume?



SM Subashini Mahendran Syncfusion Team March 10, 2022 04:00 PM UTC

Hi Ammar,


Sorry for the delay.


We have validated and confirmed the reported scenario is a defect and logged a report for the reported scenario “TargetParameterCountException was thrown when selecting the value in MultiColumnComboBox after clearing the text”. We will provide the patch for the reported issue on 25th March 2022. 


You can track the status of this defect using the following feedback link:      

https://www.syncfusion.com/feedback/33326/targetparametercountexception-was-thrown-when-selecting-the-value-in


If you have any more specification replication procedures or a scenario to be tested, you can add it as a comment in the portal.    


Regards,

Subashini M.



AM Ammar March 10, 2022 05:18 PM UTC

Thank you for your response I appreciate it, looking forward to March 25,2022



SM Subashini Mahendran Syncfusion Team March 25, 2022 11:42 AM UTC

Hi Ammar,

We have fixed the reported issue - “TargetParameterCountException was thrown when selecting the value in MultiColumnComboBox after clearing the text”. Please find the patch file from the following location:     


V19.4.0.48

Recommended approach – exe will perform automatic configuration                  

Please find the patch setup here:        

https://syncfusion.com/Installs/support/patch/19.4.0.48/1441089/F173506/SyncfusionPatch_19.4.0.48_1441089_3252022030246999_F173506.exe


Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment                                   

Please find the patch assemblies alone from:     

https://syncfusion.com/Installs/support/patch/19.4.0.48/1441089/F173506/SyncfusionPatch_19.4.0.48_1441089_3252022030246999_F173506.zip

 

Please find the NuGet from the location below:

https://syncfusion.com/Installs/support/patch/19.4.0.48/1441089/F173506/SyncfusionNuget_19.4.0.48_1441089_3252022030246999_F173506.zip     


Installation Directions:           

This patch should replace the files "Syncfusion.Tools.Windows” under the following folder.           

$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\[TargetFramework]           

E.g. : $system drive:\Program Files\Syncfusion\Essential Studio\19.4.0.48\precompiledassemblies\19.4.0.48\4.6 


To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you must manually copy and paste them to the preferred location, or you must run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.           

https://www.syncfusion.com/support/directtrac/patches 


Disclaimer:                                 

Please note that we have created this patch for the version 19.4.0.48 specifically to resolve the issues reported in this forum #173506. If you have received other patches for the same version for other products. This fix will be included in our upcoming Volume 1, SP release which will be available at the mid of May 2022.

Please let us know if you need any further assistance.  


Regards,
Subashini M.



AM Ammar replied to Subashini Mahendran March 25, 2022 01:43 PM UTC

Does this patch also work for .NET 6.0?



SM Subashini Mahendran Syncfusion Team March 25, 2022 05:19 PM UTC

Hi Ammar,


Provided patch works for both .NET framework and .NET core versions.


Please let us know if you need any further assistance.


Regards,

Subashini M.


Marked as answer

AM Ammar replied to Subashini Mahendran March 28, 2022 10:54 AM UTC

Thank you very much



MS Mahalakshmi Sugumar Syncfusion Team March 30, 2022 05:48 AM UTC

Hi Ammar,

We are glad to know that your issue has been fixed. Please let us know if you need any other assistance. We are happy to assist you.

Regards,
Mahalakshmi Sugumar


Loader.
Up arrow icon