Apologies: Accidentally hit the tab key while typing causing a premature post! Please ignore any previous post by me today!
Hi All, I've created a PluginManager assembly, using the one in 'The CodeProject' as a base. My understanding of the plugin manager is that it dynamically picks up types in an assembly (by watching the plugin directory) and then makes the type available within the main AppDomain. How it achieves this is slightly off topic but I think it creates a temporary AppDomain and then 'copies' the type into the main one from there. My problem is that what I end up with is not the type itself but a proxy to it. Should I try to call any of the methods of the type (by casting from to the type I want) I get an error: "Cannot obtain fields or call methods on the instance of type 'My.Type.Name' because it is a proxy to a remote object". The type I am attempting to load in inherited from an abstract class held in assembly that is referenced throughout the app. The abstract class inherits from MarshallByRefObject. Code snippet: string typename = "MyTypeName"; // where this type inherits from 'MyTypeBase' MyType obj = PluginManager.CreateInstance("MyTypeName", System.Reflection.BindingFlags.CreateInstance, new string[] { }); // Error on next line obj.SimpleMethod(); // where SimpleMethod is a virtual method from MyTypeBase I'm using VS 2005 / c# / .Net 2.0 Driving me mad so any suggestions very welcome! Kind regards, Graeme =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com