473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Usage of AppDomain.CreateInstanceFromAndUnwrap method

i am trying to load a Windows Form Assembly at run time to a seprate AppDomain.
I don't want that this Assembly to be loaded in the Caller Domain, so i used the metho
CreateInstanceFromAndUnwrap instead of AppDomain.Load(..
// I am passing the Control's parent through the constructor argumen
Object[] args1 = new Object[] {this}
AppDomainSetup info = new AppDomainSetup()
info.ApplicationBase = "file:///" + System.Environment.CurrentDirectory
AppDomain MyDomain = AppDomain.CreateDomain("MyDomain", null, info)
MyControl.MyControl Ctrl = (MyControl.MyControl) MyDomain.CreateInstanceFromAndUnwrap("D:\Test\MyCo ntrol.dll",MyControl.MyControl
false,BindingFlags.Public,null,args1,null,null,nul l)
But when i do this i get an exception thrown "Constructor on type MyControl.MyControl not found
What should be cause of this issue?

If i try to use the CreateInstanceFromAndUnwrap using the two parameters just the assembly and type, the functio
returns me the control object. But when i try to set the Parent of the control using the followin
code
Ctrl.Parent = this

then system throws an 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

What am i doing any thing wrong in this both scenarios
Or is it advisable to have a design where i can load my Windows Forms Assemblies in to a seprat
Domain and use, and later unload it

Any body please help....
Nov 22 '05 #1
0 1266

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Vineeth Karinta | last post by:
i am trying to load a Windows Form Assembly at run time to a seprate AppDomain. I don't want that this Assembly to be loaded in the Caller Domain, so i used the metho CreateInstanceFromAndUnwrap...
2
by: Foehammer | last post by:
Hello, I'm trying to load an assembly dynamically using an app domain. This is a proof-of-concept for a larger project, so please excuse the lame class names. TestLib is the dll where all the...
6
by: Wal Turner | last post by:
Hi there. There are various snippets on forums regarding issues with AppDomain.Unload and how it just doesnt work. Fortunately, I got it working with the base case, after much fiddling. Consider...
0
by: JonS. | last post by:
Hey All, I'm currently working on a program that dynamically loads assemblies from a directory each into their own seperate AppDomains using a somewhat logical extension of Eric Gunnerson's...
3
by: ZhangZQ | last post by:
Supposing I have a class "UserControl1 : System.Windows.Forms.UserControl" in an Assembly "UI.dll", now I create an Application project and want to use the "UserControl1" in another AppDomain, ...
0
by: marfi95 | last post by:
Hi all, I'm writing some code to automatically update my application when changes have been made. I had it all working by using the LoadFrom method of an assembly and checking the version...
5
by: Benny Raymond | last post by:
What should I do instead of this: AppDomain.CurrentDomain.AppendPrivatePath(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"\plugins"); now that...
0
by: Mick | last post by:
Hello all! Can anybody provide a good example for the Reflectio.Emitl namespace usage? The problem I'm trying to solve is copying the method body from existing class to newly created one. Below...
0
by: Michael | last post by:
Hi Everyone, I'm having a problem loadin a assembly into memory. Here is the code I'm trying to run(Its a C# convert from an article (Search Dynamically for Plug-ins): Dim domain As AppDomain =...
1
by: ThunderMusic | last post by:
Hi, (My code is at the end of this post) I have an AppDomain that must load a simple assembly that has only one class with one method and it does not work... I receive this exception : "Could...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.