The referenced OpenAccessContext or 'IObjectScope' i

Posted by Community Admin on 04-Aug-2018 17:17

The referenced OpenAccessContext or 'IObjectScope' is already closed (UnsynchronizedPMProxy)

All Replies

Posted by Community Admin on 30-May-2014 00:00
I am trying to Cache a list of Telerik.Sitefinity.DynamicModules.Model.DynamicContent and I get Telerik,OpenAccess.Exception.InvalidOperationException. 

var content= new List<Telerik.Sitefinity.DynamicModules.Model.DynamicContent>(); if (System.Web.HttpContext.Current.Cache["content"] == null)

            allMyAccounts = dmm.GetDataItems(Content).Where(s => s.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live).ToList(); System.Web.HttpContext.Current.Cache.Add("content", content, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 15, 0), System.Web.Caching.CacheItemPriority.NotRemovable, null);

else

content= (List<Telerik.Sitefinity.DynamicModules.Model.DynamicContent>)System.Web.HttpContext.Current.Cache["content"];



When the data is not cached yet, I get the results fine. But getting the results back from the cache is an issue.

And I get 
The referenced OpenAccessContext or 'IObjectScope' is already closed (UnsynchronizedPMProxy).

Thanks in advance.


Posted by Community Admin on 31-May-2014 00:00
Hello Ravi,

This issue is caused by a query pulling dynamic items out of cache. As dynamic items cannot exist without the DynamicManager, the .Net garbage collector releases the manager from the memory (as it is not used by your code anymore) and then if you pull those items from cache you will get "IObjectScope is already closed".

Keeping those items in a List, will prevent the garbage collector from disposing the DynamicManager.

Regards,
Vassil Vassilev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 
Posted by Community Admin on 31-May-2014 00:00

I were also getting same error in some other context as explained in stackoverflow.com/.../the-referenced-openaccesscontext-or-iobjectscope-is-already-closed-unsynchron

Posted by Community Admin on 01-Jun-2014 00:00

Thank you Vassil.

I cached them as a Model since I am using MVC and that resolved my issue.

Thank you.

This thread is closed