0
votes

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?

2

2 Answers

1
votes

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.

1
votes

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.