External Assembly not found when calling instance method

We are using MEF as our JobActivator. The MEF Container loads assemblies from a specified folder of plugins (not bin folder)

The JobActivator successfully finds and creates the instance however once it is passed off to HangFire it cannot find the assembly reference to call the method. I have not looked through the code yet to see how HangFire calls the method on the instance but I assumed it was with reflection and wouldn’t need to know that actual assembly in this situation ( I realize mine is a simplified entry point ).

The job will execute successfully if I move the dll’s to the bin folder however that was not the hopeful implementation.

hi Aworral

What kind of your system? This situation is very interested. I hope Hangfire author can give you helpful information to resolve your problem.
With my knowledge I think that the problem come from application domain and time you start Hangfire.

I think I narrowed down the issue a little bit.

We use MEF to derive the type for Job activation, however before a job is activated the definition is deserialized in InvocationData.

public Job Deserialize()
var type = System.Type.GetType(Type, throwOnError: true, ignoreCase: true);

The bold line assume the current AppDomain can derive the type form the name, however the named class is loaded via MEF as a plugin, not from original AppDomain. We would prefer to not load the assembly first either. Can we make it the job of the Activator to translate the Type name as opposed to current app domain so we can look in other dlls as needed.

Something like activator.GetType(string typeName), and have the current activator do the same thing you currently do, but allow me to override.

Hi aworral,
do you resolve it?

I got a same issue too…