Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / February 2008

Tip: Looking for answers? Try searching our database.

ReflectionOnlyLoadFrom vs LoadFrom

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fiz - 15 Feb 2008 18:57 GMT
If an assembly is loaded into the appdomain using ReflectionOnlyLoadFrom API,
how can I change it to Assembly::LoadFrom? Or, is it ok to load an assembly
using LoadFrom even if it had already loaded using ReflectionOnlyLoadFrom ?
Jeroen Mostert - 15 Feb 2008 21:20 GMT
> If an assembly is loaded into the appdomain using ReflectionOnlyLoadFrom API,
> how can I change it to Assembly::LoadFrom?

You can't. Assemblies cannot move between contexts.

> Or, is it ok to load an assembly using LoadFrom even if it had already
> loaded using ReflectionOnlyLoadFrom ?

Yes. There are three contexts (four if you include "no context"):

- The load context. This is the context we all know and love, where
assemblies are probed in the usual way and dependencies are loaded.
- The load-from context. This is the context for assemblies loaded by path,
with LoadFrom() and ExecuteAssembly(). Dependencies are loaded.
- The reflection-only context. This is the context for assemblies loaded by
one of the ReflectionOnly*() methods. No dependencies are loaded and code
cannot be executed.

The rules for these contexts are given in the MSDN under
Assembly.LoadFrom(). Basically, the reflection-only context is always
separate from the rest; the load and load-from contexts are more or less
shared, but with great potential for difficulties.

The reflection-only context is still constrained by the rule that you can't
load two assemblies with the same display name but different identities into
the same context, but it won't clash with the others.

Signature

J.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.