We are leaving Russia. We are against aggression and war with Ukraine. It is a tragedy for our nations, it is a nightmare

"Could not load the job" when scheduling the job from dynamically loaded module

Our application has modular architecture and some modules are loaded from location other than app’s root (they are located in subfolder Modules/PaymentsImport.dll). We’re using MEF to load these modules.
When I’m trying to schedule job from any dynamically loaded module, I’m getting error:
Recurring job 'PaymentsImportJob.Execute' can not be scheduled due to job load exception. Hangfire.Common.JobLoadException: Could not load the job. See inner exception for the details. ---> System.IO.FileNotFoundException: Не удалось загрузить файл или сборку "PaymentsImport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" либо одну из их зависимостей. Не удается найти указанный файл.

Why are you trying to load assembly, when it is already loaded in app domain?

P.S. I’m trying to schedule via generic method:
RecurringJob.AddOrUpdate<PaymentsImportJob>(j => j.Execute(), Cron.Daily);

I’ll make refresh for this question as there are no progress for 3 years and we’re thinking about swithching to Quartz.NET.
Our problem described on this schema:


Our main process has some plugins, that cat put their own job into “DEFAULT” queue. It is supposed that default queue should be processed with main process with plugins loaded into it.
We also have secondary server for heavy reporting jobs and email sending. This server is configured for separate queue “EMAIL”.
But unexpected thing here that this secondary server tries by some reason to deserialize plugin job from DEFAULT queue and off course crashes with:

System.InvalidOperationException: Recurring job can't be scheduled, see inner exception for details. ---> Hangfire.Common.JobLoadException: Could not load the job. See inner exception for the details. ---> System.IO.FileNotFoundException: Could not load file or assembly "Plugin1, PublicKeyToken=null" or one of its dependencies. The system cannot find the file specified.
   в System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   в System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   в System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   в Hangfire.Common.TypeHelper.AssemblyResolver(String assemblyString)
   в System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   в System.TypeNameParser.ResolveAssembly(String asmName, Func`2 assemblyResolver, Boolean throwOnError, StackCrawlMark& stackMark)
   в System.TypeNameParser.ConstructType(Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
   в System.TypeNameParser.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
   в System.Type.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError)
   в Hangfire.Common.TypeHelper.DefaultTypeResolver(String typeName)
   в Hangfire.Storage.InvocationData.DeserializeJob()