This is a migrated thread and some comments may be shown as answers.

System.InvalidOperationException: Control already added!

3 Answers 163 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 05 Jan 2012, 06:37 PM
Hello, I am very new to Telerik, but others in my group have been using it for some time and nobody else experiences this issue and cannot reproduce this issue.

I am modifying a GUI that has been generated by another engineer, simply, I am moving a button by only a couple of pixels and the VS2010 designer changes nearly a hundred of lines of code in the designer.cs file.  But they only lines of code that prevent the GUI from displaying are included here, and at the bottom of the message is the exception that occurs at run-time.

Original Code (Bold code is removed by the VS designer/Telerik after button is moved):
            // 
            // radScrollablePanel1
            // 
            this.radScrollablePanel1.AutoScroll = true;
            this.radScrollablePanel1.AutoScrollMargin = new System.Drawing.Size(0, 0);
            this.radScrollablePanel1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
            this.radScrollablePanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.radScrollablePanel1.Location = new System.Drawing.Point(0, 0);
            this.radScrollablePanel1.Name = "radScrollablePanel1";
            this.radScrollablePanel1.Padding = new System.Windows.Forms.Padding(1);
            // 
            // radScrollablePanel1.PanelContainer
            // 
            this.radScrollablePanel1.PanelContainer.AutoScroll = true;
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel8);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel14);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel1);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel13);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel2);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel12);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel3);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel11);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel4);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel10);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel5);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel9);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel6);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.label12);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.panel7);
            this.radScrollablePanel1.PanelContainer.Controls.Add(this.GeneralQryResultRichTextBox);
            this.radScrollablePanel1.PanelContainer.Dock = System.Windows.Forms.DockStyle.Fill;
            this.radScrollablePanel1.PanelContainer.Location = new System.Drawing.Point(1, 1);
            this.radScrollablePanel1.PanelContainer.Name = "PanelContainer";
            this.radScrollablePanel1.PanelContainer.Size = new System.Drawing.Size(940, 530);
            this.radScrollablePanel1.PanelContainer.TabIndex = 0;


After Modification of the button control (Bold code is added by the VS/Telerik after button is moved): 
            // 
            // radScrollablePanel1
            // 
            this.radScrollablePanel1.AutoScrollMargin = new System.Drawing.Size(0, 0);
            this.radScrollablePanel1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
            this.radScrollablePanel1.Controls.Add(this.radScrollablePanel1.PanelContainer);
            this.radScrollablePanel1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.radScrollablePanel1.Location = new System.Drawing.Point(0, 0);
            this.radScrollablePanel1.Name = "radScrollablePanel1";
            this.radScrollablePanel1.Padding = new System.Windows.Forms.Padding(1);



During runtime I get this exception at the Bolded line in the "After" section:
*** [05 Jan 2012 10:17:25.701 WSApp     ] [ERROR] System.ApplicationException: Unable to create an instance of the B.WS.SnapIn.RV.RVControlSnapIn plugin in the assembly named B.WS.SnapIn.RV. 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Control already added!
   at Telerik.WinControls.UI.RadScrollablePanelControlCollection.Add(Control value)
   at B.WS.SnapIn.RV.RVControlSnapIn.InitializeComponent() in C:\_dev\VS\Main\S\Apps\WS Apps\Libs\B.WS.SnapIn.RV\RVControlSnapIn.designer.cs:line 1755
   at B.WS.SnapIn.RV.RVControlSnapIn..ctor() in C:\_dev\VS\Main\S\Apps\WS Apps\Libs\B.WS.SnapIn.RV\RVControlSnapIn.cs:line 41
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
   at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at B.NE.PluginFramework.PluginManager.LoadPlugin(String typeName, String path, Hashtable parameters) in C:\_dev\VS\Main\S\SLibs\B.NE.PluginFramework\PluginManager.cs:line 438 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: Control already added!
   at Telerik.WinControls.UI.RadScrollablePanelControlCollection.Add(Control value)
   at B.WS.SnapIn.RV.RVControlSnapIn.InitializeComponent() in C:\_dev\VS\Main\S\Apps\WS Apps\Libs\B.WS.SnapIn.RV\RVControlSnapIn.designer.cs:line 1755
   at B.WS.SnapIn.RV.RVControlSnapIn..ctor() in C:\_dev\VS\Main\S\Apps\WS Apps\Libs\B.WS.SnapIn.RV\RVControlSnapIn.cs:line 41
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
   at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at B.NE.PluginFramework.PluginManager.LoadPlugin(String typeName, String path, Hashtable parameters) in C:\_dev\VS\Main\S\SLibs\B.NE.PluginFramework\PluginManager.cs:line 438
   --- End of inner exception stack trace ---
   at B.NE.PluginFramework.PluginManager.LoadPlugin(String typeName, String path, Hashtable parameters) in C:\_dev\VS\Main\S\SLibs\B.NE.PluginFramework\PluginManager.cs:line 461
   at WSContainer.WSContainerNode.AddPlugin(String typeName, String path, Hashtable parameters) in C:\_dev\VS\Main\S\Apps\WS Apps\WSContainer\WSContainerNode.cs:line 133
   at WSContainer.WSApp.LoadPlugin(Guid id, String typeName, String path) in C:\_dev\VS\Main\S\Apps\WS Apps\WSContainer\WSApp.cs:line 792

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 09 Jan 2012, 03:51 PM
Hello,

Your question has already been answered in the support her thread you have opened. Please, see our answer there for more information.

We kindly ask you to use just one support channel to contact us. Posting the same questions several times slows down our response time, because we need to review and address two or more tickets instead of one. Support tickets are handled according to license and time of posting, so if it is an urgent issue, we suggest you directly open a support ticket, which would be handled before a forum thread.

Thank you for your understanding.

Kind regards,
Stefan
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Mehul
Top achievements
Rank 1
answered on 30 Jun 2012, 04:45 PM
Where is the answer for this question?

Can you please help me to get the link for that?

Thanks,
Mehul
0
Stefan
Telerik team
answered on 04 Jul 2012, 01:29 PM
Hi Mehul,

This conversation continued in a support thread where we have asked for a sample project and since then this case has no development. If you experience similar issue, please open a new support ticket and attach a sample project demonstrating the experienced it, together with exacts steps that we need to follow in order to reproduce it. Once we are able to do that, we will be able to assist you appropriately.
 
Regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
William
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Mehul
Top achievements
Rank 1
Share this question
or