Bordel Bordel
Bordel Bordel

Reputation: 61

ReflectionTypeLoadException: Unable to load one or more of the requested types(LoaderExceptions)

I have a problem with my application where I load a list of assemblies (Assembly.LoadFrom) from a path (\ \ RemoteServerDir ...) and when I try to retrieve all types of each assemblies i get errors when calling assembly.GetTypes () method.

The message that i have is "ReflectionTypeLoadException: Unable to load one or more of the Requested types (LoaderExceptions)".

Does someone has an idea to solve this? For information, this application is running in distributed mode who i have this probleme but in local mode it works well.

Thank you.

Upvotes: 1

Views: 2768

Answers (1)

Yevgeniy Rozhkov
Yevgeniy Rozhkov

Reputation: 80

Most probably it is has to do with different permission level when you loading remote assemplies

Please try replacing Assembly.LoadFrom to Assembly.UnsafeLoadFrom available in C# 4.0 MSDN which will bypass security checks

Old way is to add configuration section

<configuration>
    <runtime>
        <loadFromRemoteSources enabled="true" />
    </runtime>
</configuration>

which will load assembly with full trust

Upvotes: 2

Related Questions