NVM
NVM

Reputation: 5552

Dynamically loading an assembly which expects GAC assemblies which are not actually available?

What happens if an application tries to load an assembly which has references to assemblies in the GAC and these assemblies are not available on the machine?

Basically I want to rely on assembly loading succeeding to assume that the referenced assemblies are available on the end users machine. Am I being dense?

Upvotes: 0

Views: 342

Answers (2)

Moo-Juice
Moo-Juice

Reputation: 38825

Basically I want to rely on assembly loading succeeding

It never pays to rely on something like this! Anyway, to answer your question, you'll get an exception. If an exception is not thrown then the dependent assemblies have been loaded. If an exception is thrown, then either they're not there, or some other problem has occurred.

Upvotes: 1

Femaref
Femaref

Reputation: 61437

If the runtime isn't able to load a required assembly, it will throw an exception (doesn't matter if you try to load it at startup or dynamically via Assembly.Load()). So if you don't get an exception, you can expect the classes to be avaiable.

Upvotes: 1

Related Questions