A CLR error occurred while invoking the scheduling engine

We came across this issue recently. When running the Production Job scheduling process you experience error  “A CLR error occurred while invoking the scheduling engine.” and the exception details look like this

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation —>  Microsoft.Dynamics.AX.ManagedInterop.ContainerNotValidException
 The Microsoft Dynamics container being referenced is not valid at Microsoft.Dynamics.AX.ManagedInterop.Container.get_Count()

The issue in this was caused by the AOS Server configuration option “Enable the hot-swapping of assemblies for each development session” being enabled on the server. This option should NOT be activated on production environments.Disabling th eoption resolved the issue

However there are other causes of production job scheduling issues, and this are mentioned in the Microsoft Dynamics AX 2012 Release Notes. One of them being:  “The resource scheduling engine uses a hard-coded resource name for jobs that do not include a resource or calendar. The hard-coded resource name is “EmptyRes”. This hard-coded name might conflict with actual resource names. There is no workaround for this issue.” The solution for this is to create a new resource: “emptyres”.