locked
Differences between Assembly.Load() and Assembly.LoadFrom() and related concept (Load context or LoadFrom context) in CLR4 RRS feed

  • Question

  • I know similar question has been posted. But i'm asking this question specific to CLR4.

    I read several related articles, it seems they behave differenently in difference CLR version (Maybe i'm wrong)

    Here are the questions:

    Q1. If i try to load a target assembly which is under the probing path with Assembly.Load(), this target assembly will be loaded in Load context, but will all the dependencies of this target assembly be loaded into Load context at the same time? if so what happens if some of the dependencies are not under probing path?

    Q2. If i try to load a target assembly which is under the probing path with Assembly.LoadFrom(), which context this target assembly will be loaded into? Load context or LoadFrom context?

    Q3. If one assembly trys to load a target assembly which is not under the probing path with Assembly.LoadFrom(), this target assembly will be loaded in LoadFrom context, but will all the dependencies of this target assembly be loaded into LoadFrom context at the same time? if so what happens if some of the dependencies are not under same path and not under probing path? And will those dependencies be loaded into Load context that is under probing path?

    Q4. If a same identity assembly has been loaded into Load context with Assembly.Load(), what happens if i trys to load a same identity assembly with Assembly.LoadFrom() with a path that is under probing path? and what happens if i trys to load a same identity assembly with Assembly.LoadFrom() with a path that is not under probing path?

    Q5. If a same identity assembly has been loaded into LoadFrom context with Assembly.LoadFrom() with a path not under probing path, what happens if i trys to load a same identity assembly that is under probing path into Load context with Assembly.Load()?

    I came up with these question after i read some realed MSDN article.

    Thanks in advance. 

    Wednesday, April 11, 2012 2:44 AM

Answers

All replies