Not used reference assemblies

V

Vadym Stetsyak

Hi there

I am building an assembly Asm1, and it has references to Asm2 and Asm3.
(/reference: Asm2.dll Asm3.dll)

In Asm1 I am using types only from Asm2. The question is will CLR loader
load Asm3?
I assume that assemblies are loaded only when we reference to the type that
assembly contains
 
C

Cezary Nolewajka

Even better than that.

Assemblies are loaded, when a type defined in an assembly is instantiated or
used. Then, the JIT compiler compiles the adaquate portion of the assembly
IL.

Cezary Nolewajka
mailto:[email protected]
remove all "no-sp-am-eh"s to reply
 
V

Vadym Stetsyak

So there is the possibility that Asm3 won't be at all and the application
won't crush

Cezary Nolewajka said:
Even better than that.

Assemblies are loaded, when a type defined in an assembly is instantiated or
used. Then, the JIT compiler compiles the adaquate portion of the assembly
IL.

Cezary Nolewajka
mailto:[email protected]
remove all "no-sp-am-eh"s to reply
 
C

Cezary Nolewajka

You are absolutely right. If a type from an assembly is not used - it's not
even loaded and does not have to be present. Did a simple test.

The framework looks for the assembly file, when it's going to use a
type/code from the assembly. If it's not found (at runtime) then
FileNotFound exception is thrown.

--
Cezary Nolewajka
mailto:[email protected]
remove all "no-sp-am-eh"s to reply

Vadym Stetsyak said:
So there is the possibility that Asm3 won't be at all and the application
won't crush

Cezary Nolewajka said:
Even better than that.

Assemblies are loaded, when a type defined in an assembly is
instantiated
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top