Custom TypeResolver that uses/extends the default type resolver

aspnetcore
Tags: #<Tag:0x00007f49a6f394d0>

#1

Are there any examples of providing custom type resolves that fallback to the default type resolver? I ask because our ASPNET Core 3.1 app uses AssemblyLoadContext to load plugins as directed at https://docs.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support. The rest of our app loads dependencies just fine, but enqueueing a Hangfire job fails with the following error, even though we use the LamarActivator from the Hangfire.Lamar package:

[WRN] [&lt;s:Hangfire.AutomaticRetryAttribute&gt;] Failed to process the job '154': an exception occurred. Retry attempt 1 of 10 will be performed in 00:00:32.
System.IO.FileNotFoundException: Could not load file or assembly 'BillingPackage, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'BillingPackage, Culture=neutral, PublicKeyToken=null'
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly assemblyContext, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, StackCrawlMark&amp; stackMark, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef, StackCrawlMark&amp; stackMark, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Hangfire.Common.TypeHelper.AssemblyResolver(String assemblyString)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Hangfire.Common.TypeHelper.CachedAssemblyResolver(AssemblyName assemblyName)
at System.TypeNameParser.ResolveAssembly(String asmName, Func`2 assemblyResolver, Boolean throwOnError, StackCrawlMark&amp; stackMark)
at System.TypeNameParser.ConstructType(Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark&amp; stackMark)
at System.TypeNameParser.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark&amp; stackMark)
at System.Type.GetType(String typeName, Func`2 assemblyResolver, Func`4 typeResolver, Boolean throwOnError)
at Hangfire.Common.TypeHelper.DefaultTypeResolver(String typeName)
at Hangfire.Storage.InvocationData.DeserializeJob()