Hi all, Hopefully you guys might have some good news for me. Currently in .NET 1.0 & 1.1 when trying to remote any object based upon System.Windows.Forms.Control across app domains fails due to, I believe, the ControlCollection not being serializable. The reason why the Control object itself would be marked MarshalByRefObject and then the contents couldn't be serialized is beyond me. It caused me my fair share of headaches. I am creating and application with a Plugin framework in which we wanted to load plugin assemblies into their own AppDomain so that we could isolate, maintain, and secure the plugins seperately from our main AppDomain. This worked well for everything expect when we tried to parent an object based on Control in one AppDomain to a object based upon Control in a seperate AppDomain. We were doing this because we wanted to be able to host MDI Children forms defined in a plugin assembly in our main applications MDI parent form. This failed miserably. Is there any plans to support something like this in V 2.0 of the BCL? Any help would be appreciated.
-- Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways, chocolate in one hand, martini in the other, body thoroughly used up, totally worn out and screaming "WOO HOO what a ride!"
I can't tell you if MS is planning to do anything like this in v2.0. Best to download and check the February CTP bits for yourself.
I can clarify MarshalByRefObject though. Classes which derive from MarshalByRefObject are remotable, but are not serialized. You essentially get a remotable pointer so you can call methods on the object, but the object never leaves the app domain it was created in. Any method calls from a remote app domain to a MarshalByRefObject are marshalled back to the original app domain where the object lives. So there is no need for ControlCollection to be [Serializable] - it will never be serialized because its parent (Control) will never be serialized.
Because you are going to be marshalling all calls between the child and parent components cross app domain, there will be some fairly high performance costs even if it is possible. You'll want to think long and hard about whether you need this high level of isolation between your main app and its plugins.
Wednesday, April 13, 2005 7:33 PM
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.