Error 'Object references between two different object scopes are not allowed ' displayed when the code encounters the following statement: dynamicModuleManager.Lifecycle.Publish()
I am trying to incorporate hangfire with Sitefinity.
I have created a background job and once it goes into the method (this method is created as backgroundjob) and encounters the line ' dynamicModuleManager.Lifecycle.Publish()', I get the below error:
Object references between two different object scopes are not allowed. The object 'Telerik.Sitefinity.DynamicModules.Model.DynamicContentUrlData' is already managed by 'ObjectScopeImpl 0xd2 OpenAccessRuntime.EnlistableObjectScope' and was tried to be managed again by 'ObjectScopeImpl 0xd7 OpenAccessRuntime.EnlistableObjectScope'
Any help would be appreciated.
That problem must be due to wrapping the code for working with the DynamicModuleManager into an using statement.