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.
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