I am trying to speed up my app by loading certain DLLs into the ReflectionOnly context.
This loading occurs on a secondary AppDomain, which registers both AssemblyResolve and AssemblyReflectionOnlyResolve event handlers.
For some reason, when loading these assemblies, the code fails on this method:
Type[] tps = dll.GetTypes();
This throws an exception saying:
Cannot resolve dependency to assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.
When loading the assemblies not into the Reflection Only context, this works as assumed.
Are there any gotchas/caveats for using the Reflection Only context? why doesn't the runtime able to find this assembly in the GAC and load it as usual? am i missing something?