November Happy Hour will be moved to Thursday December 5th.

Scheduled jobs failing when scheduled in a .NET 8 containerized environment

Vote:
 

We've just recently upgraded our Optimizely solution to CMS 12 and Commerce 14 and we're running into an issue with Scheduled Jobs.  We're running on .NET 8 in linux containers in a load balanced environment.  We have no issue when running a job manually, however when scheduling them, most of the jobs run into an issue loading assemblies and fail out with "UNABLETOSTART".  We get messages like such...

Could not load file or assembly '<CLASS_LIB_ASSEMBLY>, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

We thought maybe it could be an issue with transitive dependencies in .net 8 so we started working with the AssemblyLoadContext to try and ensure all assemblies were loaded, but no luck.  

Example:

AssemblyLoadContext.Default.Resolving += (context, assemblyName) =>
{
    var assemblyPath = Path.Combine(AppContext.BaseDirectory, $"{assemblyName.Name}.dll");
    return File.Exists(assemblyPath) ? context.LoadFromAssemblyPath(assemblyPath) : null;
};

Any insight into scheduled jobs running in this context would be much appreciated.  Let me know of any more info that you'd like me to provide.  Thanks

#332397
Nov 04, 2024 17:28
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.