G
Guest
Hi,
I encountered the following problem when trying to set control parent when
the control reside in a different AppDomain.
Here is the pseudo code descibing the problem:
pay attention that both controls inherits from UserControl which inherites
(indirectly)from MarshalByRefObject.
class Control1:UserControl
{
AppDOmainSetup setup = new AppDomainSetup();
//code that initialize the setup...
AppDomain newAppDomain = AppDomain.CreateDomain("MyDomain",null,setup);
Control c2 =
(Control)newAppDomain.CreateINstanceAndUnwrap(assemblyofcontrol2,Control2);
this.Controls.Add(c2); //<===Exception (see message content below)
}
class Control2:UserControl //this control reside in a different assembly
{
}
The Exception message is:
exception the message is
The type System.Windows.Forms.Form+ControlCollection in Assembly
System.Windows.Forms, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.
I tried to mark Control2 as Serializable but it didn't help :-(
Any suggestion?
Thanks,
Burgazon
I encountered the following problem when trying to set control parent when
the control reside in a different AppDomain.
Here is the pseudo code descibing the problem:
pay attention that both controls inherits from UserControl which inherites
(indirectly)from MarshalByRefObject.
class Control1:UserControl
{
AppDOmainSetup setup = new AppDomainSetup();
//code that initialize the setup...
AppDomain newAppDomain = AppDomain.CreateDomain("MyDomain",null,setup);
Control c2 =
(Control)newAppDomain.CreateINstanceAndUnwrap(assemblyofcontrol2,Control2);
this.Controls.Add(c2); //<===Exception (see message content below)
}
class Control2:UserControl //this control reside in a different assembly
{
}
The Exception message is:
exception the message is
The type System.Windows.Forms.Form+ControlCollection in Assembly
System.Windows.Forms, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.
I tried to mark Control2 as Serializable but it didn't help :-(
Any suggestion?
Thanks,
Burgazon