471,627 Members | 2,311 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Loading Assemblies

Hello all,

When dynamically loading classes through reflection using Assembly.LoadFrom
I have the following questions:

1) Once you load an assembly it doesn't appear you can unload it. If you
try to load an assembly multiple times does this cause any type of memory
issues?

2) If you load an assembly and later you try to load a newer version of the
same assembly, does .NET know it's the same assembly and if so, what happens?

3) Before you execute Assembly.LoadFrom should you check to see if the
assembly is already loaded to avoid loading it again and if so how?

Thanks in advance,
John F
Dec 20 '05 #1
1 1769
John F wrote:
Hello all,

When dynamically loading classes through reflection using Assembly.LoadFrom
I have the following questions:

1) Once you load an assembly it doesn't appear you can unload it. If you
try to load an assembly multiple times does this cause any type of memory
issues?

2) If you load an assembly and later you try to load a newer version of the
same assembly, does .NET know it's the same assembly and if so, what happens?

3) Before you execute Assembly.LoadFrom should you check to see if the
assembly is already loaded to avoid loading it again and if so how?

Thanks in advance,
John F


see http://tinyurl.com/2r7g4
1) Almost correct. You can only unload appdomains. What you can do is to
create a new AppDomain and load you assembly into it. However, you also
have to make sure to create your object inside the new domain using
AppDomain.CreateInstanceAndUnwrap(..).
I haven't had any issues calling LoadFrom multiple times.

2)If you have a string named assembly and the version is higher it will
get loaded.

3) see 1)

HTH,
Andy
--
To email me directly, please remove the *NO*SPAM* parts below:
*NO*SPAM*xmen40@*NO*SPAM*gmx.net
Dec 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by =?Windows-1252?Q?Tor_B=E5dshaug?= | last post: by
8 posts views Thread by =?Utf-8?B?TWFyaw==?= | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

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.