Hello everyone,
I recently moved from V12.2 to V13.1 and I am getting the following error:
An error occurred creating the form. See Exception.InnerException for details. The error is: The Controls collection of the UltraPanel is read-only. Modify the UltraPanel.ClientArea.Controls collection instead.
When I click on the call stack, I find:
at Infragistics.Win.Misc.UltraPanel.UltraPanelControlCollection.Add(Control value)at System.Windows.Forms.Design.ControlDesigner.DesignerControlCollection.Add(Control c)
When I click "view detail", I get:
{"An error occurred creating the form. See Exception.InnerException for details. The error is: The Controls collection of the UltraPanel is read-only. Modify the UltraPanel.ClientArea.Controls collection instead."}
When I click copy exception detail to the clipboard, I get:
System.InvalidOperationException was unhandled HResult=-2146233079 Message=An error occurred creating the form. See Exception.InnerException for details. The error is: The Controls collection of the UltraPanel is read-only. Modify the UltraPanel.ClientArea.Controls collection instead. Source=D4 I2C Reader StackTrace: at D4_I2C_Reader.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190 at D4_I2C_Reader.My.MyProject.MyForms.get_Main() at D4_I2C_Reader.My.MyApplication.OnCreateMainForm() in C:\Users\JBrookley\Documents\TFS Local\D4 Digital Reader\D4 Digital Reader\D4 I2C Reader\My Project\Application.Designer.vb:line 35 at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at D4_I2C_Reader.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.InvalidOperationException HResult=-2146233079 Message=The Controls collection of the UltraPanel is read-only. Modify the UltraPanel.ClientArea.Controls collection instead. Source=Infragistics4.Win.Misc.v13.1 StackTrace: at Infragistics.Win.Misc.UltraPanel.UltraPanelControlCollection.Add(Control value) at D4_I2C_Reader.Main.InitializeComponent() in C:\Users\JBrookley\Documents\TFS Local\D4 Digital Reader\D4 Digital Reader\D4 I2C Reader\Main.Designer.vb:line 300 at D4_I2C_Reader.Main..ctor() in C:\Users\JBrookley\Documents\TFS Local\D4 Digital Reader\D4 Digital Reader\D4 I2C Reader\Main.vb:line 9 InnerException:
Honestly, since it will no longer load up correctly (no idea what happened/what I did, it used to work just fine and I don't think anything has changed apart from my Infragistics version), I don't really know what to change or where to start. Can anyone point me in the right direction? I'm guessing the answer is in the last bit of info I pasted but I'm having trouble reading what it's trying to tell me.
If you need any additional information, let me know. Thanks!
Hello Jeremy,
Please try the steps below to fix your issue:
1. Open Designer file of your Form
2. Find all places where you have code like: this.ultraPanel1.Controls.Add(....
3. Replace the code from point 2 with this.ultraPanel1.ClientArea.Controls.Add(....
4. Clean your solution
5. Rebuild your solution
Please take a look on attached video file for more details and if you have any questions, feel free to write me
Regards
Georgi,
I don't use controls.add anywhere in my code . . . Any other ideas or can I email I code to you (not post it in the forums) to take a look at? Let me know. Thanks!
I also suddenly started getting this error. Looking back this line did not exist in the designer in older versions, and I seem to be able to comment the line out and it works but one of the unnbound columns in my grid is also missing like it wasn't persisted to source control.
There shouldn't be any controls added directly to the UltraPanel. The ClientArea gets added to it, but that happens internally and shouldn't exist in the designer code.
What seems to be happening in a lot of these cases is that for some reason, Visual Studio can't find the Design assembly (which is basically the assembly in the GAC that provides designers and in this case handles telling the UltraPanel not to serialize out the ClientArea control). This can happen if you upgrade your Infragistics controls without running the proper installer, like just copying the assemblies onto your machine manually. Or, if there's a bug or a failure in the installer which doesn't correctly install the design assembly. And once the designer file get corrupted like this, the only thing you can do is fix it manually as noted by the instructions above.
The infragistics update utility has never worked on my projects for years now. I spent many hours trying to get someone to help me resolve this but was not successful. It would just generate some generic error message with no detail to help track down what the problem was. Since then every time I have to manually update all the libraries every time there is a new version.. a process that takes a long time because it is a large project.
I tried the change you suggested at the top post but I get an error about a circular reference if I change the line to this: this.ultraPanel1.Controls.Add(this.ultraPanel1.ClientArea);
So, I just commented out those line.
Now I see this error but there is no mention of this method anywhere in my source code:
Ahh nevermind found it.. I subclassed the editor control
Now I get this.. I don't know how everything can get so broken when I haven't changed my code..
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkPropertyDescriptor.SetValue(Object component, Object value)at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
Thank you for sharing what resolved the issue for you.
Hi Alan.. cleaning and rebuilding didn't help but I eventually resolved the issue through two changes.. #1 I removed all the infragistics control references and re-added them. Even though the version number in the properties remained the same this got rid of a number of the errors and allowed the designer to load. At this point all my grid customizations were lost.. I tracked this problem down to a change that happened after I upgraded the infragistics controls and loaded the designer previously. I reverted to an old version of the designer file from source control and all was good. I also tried reverting to the older version of the winforms controls, opening the grid in the designer and exporting the layout to a file then upgrading the controls and importing the layout.. that seemed to work as well.
My best guess is that I upgraded to the latest winforms service release for another project and forgot to manually upgrade this project like I usually do by removing all the assemblies and re-adding the new version. Then when the form got loaded in the designer something got corrupted.
Greg,
There isn't anything in the call stack that indicates this has anything to do with Infragistics and my be a Visual Studio behavior/issue. I did search for other instances of a similar exception and found the same call stack in Designer Error in Existing Project. The resolution to that thread was to rebuild a user control and the issue was specific to nested user controls. You may want to clean and rebuild all of your dependencies to see if that changes the behavior.