We\'re working on a very large .NET WinForms composite application - not CAB, but a similar home grown framework. We\'re running in a Citrix and RDP environment running on
I faced this exception while adding controls in to the panel, Because in panel child controls not cleared. If dispose the child controls in panel then bug fixed.
For k = 1 To Panel.Controls.Count
Panel.Controls.Item(0).Dispose()
Next
I am using the Janus Controls at work. They are extremely buggy as far as disposing of themselves go. I would recommend that you make sure that they are getting disposed of correctly. Also, the binding with them sometimes doesn't release, so you have to manually unbind the object to dispose of the control.
same error occured when i started using threading in my WinForm App, i used stack trace to find what is throwing error and found out UltraDesktopAlert component of infragistics was behind this so i invoked it differently and error is now gone.
this.Invoke((MethodInvoker)delegate
{
//call your method here
});
the full code will look like this.
private void ultraButton1_Click(object sender, EventArgs e)
{
Task.Factory.StartNew(() => myMethod1());
}
void myMethod1()
{
//my logic
this.Invoke((MethodInvoker)delegate
{
ultraDesktopAlert1.Show($"my message header", "my message");
});
//my logic
}
also i was unable to use GDI utility to find how many handle my app creates but my app (64bit) was not available in its list.
another solution was to change desktop heap value to SharedSection=1024,20480,768
at following location HKEY
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems
but mine was already with same values. only invoke method delegate worked for me. hope this helped.