XSLT error: ...An attempt was made to reference a CacheDependency object from more than one Cache entry.
Hi there,
one of my sites is having some problems with my XSLT macro's sometimes. This happens occasionally, not very often. General message shown is "Error parsing XSLT file". After a second pageload the problem is gone by itself.
It's always the first XSLT macro on the page. I first thought my main-navigation macro could be the problem, so i replaced that one with a Razor-macro. Now the next macro is giving me the message.
Last few weeks i always used umbDebugShowTrace=true on my homepage, and today the macro failed again so i could see the debugtrace. This is the message i can see in the trace:
An attempt was made to reference a CacheDependency object from more than one Cache entry. An attempt was made to reference a CacheDependency object from more than one Cache entry. at System.Web.Caching.CacheEntry.MonitorDependencyChanges() at System.Web.Caching.CacheSingle.UpdateCache(CacheKey cacheKey, CacheEntry newEntry, Boolean replace, CacheItemRemovedReason removedReason, Object& valueOld) at System.Web.Caching.CacheInternal.DoInsert(Boolean isPublic, String key, Object value, CacheDependency dependencies, DateTime utcAbsoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, CacheItemRemovedCallback onRemoveCallback, Boolean replace) at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem) at umbraco.macro.GetXsltExtensions() at umbraco.macro.AddMacroXsltExtensions() at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters) at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)
I'm using version 4.7.1.1 (Assembly version: 1.0.4393.24044) on multiple sites. Have seen the error on only one of those sites, a site that is not used very often.
No answer yet, still occasionally see the error message, so maybe i need to provide some more information?
Running Umbraco 4.7.1.1 on Windows Server 2008 R2, with SQL Server 2008 R2. There are several macro's on the (home)page, and one is called twice with different macro parameters, but that's not the macro that is failing: its always the first macro on the page that fails.
Diving into this further, trying to reproduce the situation, i now have created a page with a Razor-macro clearing the ASP.NET cache (using HttpContext.Current.Cache.Remove for all cached items). Following one the same page, there are two XSLT macro's. After clearing the cache the first XSLT macro will throw the same error ("An attempt was made to reference a CacheDependency object from more than one Cache entry"), so that's a way to reproduce this.
I'm not sure if what i do here is valid, but could this be the problem with my site (a cleared ASP.NET cache)?
Ok, still fighting to find out what's going on. I downgraded to version 4.7.1 (Assembly version: 1.0.4315.19820) today. And surprise: in that version the problem is gone. So it must be the upgrade to 4.7.1.1 that started this problem.
Summarizing: - Sometimes, the first XSLT-macro on my site is failing. At the next pageload the failure is gone. - This happens in version 4.7.1.1 (Assembly version: 1.0.4393.24044) on Windows 2008 R2 / MS SQL 2008 R2 - It does not happen in version 4.7.1 (Assembly version: 1.0.4315.19820) - It lookes that the cause is a "cleared" ASP.NET cache. - By iterating over the cacheitems and clearing them with the following code, the problem can be reproduced: var enumerator = HttpContext.Current.Cache.GetEnumerator(); while (enumerator.MoveNext()) { string item = enumerator.Key.ToString(); HttpContext.Current.Cache.Remove(item); } After running this code and going back to the homepage, the problem appears. (but not in version 4.7.1)
When I try to save an XSLT file inside Umbraco, this error comes:
System.NullReferenceException: Object reference not set to an instance of an object. at umbraco.macro.GetXsltExtensionsImpl() at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem) at umbraco.macro.GetXsltExtensions() at umbraco.macro.AddMacroXsltExtensions() at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
Thank you Steve, finally someone who knows what's going on, and with a solution. I haven't been able to test the latest Umbraco release so i'm not sure if this is solved in the latest build, but it seems to me that this case can be closed. Thank you again.
XSLT error: ...An attempt was made to reference a CacheDependency object from more than one Cache entry.
Hi there,
one of my sites is having some problems with my XSLT macro's sometimes. This happens occasionally, not very often. General message shown is "Error parsing XSLT file". After a second pageload the problem is gone by itself.
It's always the first XSLT macro on the page. I first thought my main-navigation macro could be the problem, so i replaced that one with a Razor-macro. Now the next macro is giving me the message.
Last few weeks i always used umbDebugShowTrace=true on my homepage, and today the macro failed again so i could see the debugtrace. This is the message i can see in the trace:
An attempt was made to reference a CacheDependency object from more than one Cache entry.
An attempt was made to reference a CacheDependency object from more than one Cache entry.
at System.Web.Caching.CacheEntry.MonitorDependencyChanges()
at System.Web.Caching.CacheSingle.UpdateCache(CacheKey cacheKey, CacheEntry newEntry, Boolean replace, CacheItemRemovedReason removedReason, Object& valueOld)
at System.Web.Caching.CacheInternal.DoInsert(Boolean isPublic, String key, Object value, CacheDependency dependencies, DateTime utcAbsoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, CacheItemRemovedCallback onRemoveCallback, Boolean replace)
at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
at umbraco.macro.GetXsltExtensions()
at umbraco.macro.AddMacroXsltExtensions()
at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters)
at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements)
I'm using version 4.7.1.1 (Assembly version: 1.0.4393.24044) on multiple sites. Have seen the error on only one of those sites, a site that is not used very often.
Any solution?
Regards;
Gerard
No answer yet, still occasionally see the error message, so maybe i need to provide some more information?
Running Umbraco 4.7.1.1 on Windows Server 2008 R2, with SQL Server 2008 R2. There are several macro's on the (home)page, and one is called twice with different macro parameters, but that's not the macro that is failing: its always the first macro on the page that fails.
Diving into this further, trying to reproduce the situation, i now have created a page with a Razor-macro clearing the ASP.NET cache (using HttpContext.Current.Cache.Remove for all cached items).
Following one the same page, there are two XSLT macro's. After clearing the cache the first XSLT macro will throw the same error ("An attempt was made to reference a CacheDependency object from more than one Cache entry"), so that's a way to reproduce this.
I'm not sure if what i do here is valid, but could this be the problem with my site (a cleared ASP.NET cache)?
Ok, still fighting to find out what's going on. I downgraded to version 4.7.1 (Assembly version: 1.0.4315.19820) today. And surprise: in that version the problem is gone. So it must be the upgrade to 4.7.1.1 that started this problem.
Summarizing:
- Sometimes, the first XSLT-macro on my site is failing. At the next pageload the failure is gone.
- This happens in version 4.7.1.1 (Assembly version: 1.0.4393.24044) on Windows 2008 R2 / MS SQL 2008 R2
- It does not happen in version 4.7.1 (Assembly version: 1.0.4315.19820)
- It lookes that the cause is a "cleared" ASP.NET cache.
- By iterating over the cacheitems and clearing them with the following code, the problem can be reproduced:
var enumerator = HttpContext.Current.Cache.GetEnumerator();
while (enumerator.MoveNext())
{
string item = enumerator.Key.ToString();
HttpContext.Current.Cache.Remove(item);
}
After running this code and going back to the homepage, the problem appears. (but not in version 4.7.1)
I am having the very same error, but on a clean install of a 4.7.1.1 ... how can this be fixed?
When I try to save an XSLT file inside Umbraco, this error comes:
I've submitted a patch to fix this on Codeplex.
Thank you Steve, finally someone who knows what's going on, and with a solution. I haven't been able to test the latest Umbraco release so i'm not sure if this is solved in the latest build, but it seems to me that this case can be closed. Thank you again.
is working on a reply...