473,626 Members | 3,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cache_dependenc y_used_more_tha t_once Exception when adding to .NET cache

Hi,

I'm trying to add an object to the .NET cache using a CacheDependency
and I get the following exception :

System.InvalidO perationExcepti on: Cache_dependenc y_used_more_tha t_once
at System.Web.Cach ing.CacheEntry. MonitorDependen cyChanges()
at System.Web.Cach ing.CacheSingle .UpdateCache(Ca cheKey cacheKey,
CacheEntry newEntry, Boolean replace, CacheItemRemove dReason
removedReason, Object& valueOld)
at System.Web.Cach ing.CacheMultip le.UpdateCache( CacheKey cacheKey,
CacheEntry newEntry, Boolean replace, CacheItemRemove dReason
removedReason, Object& valueOld)
at System.Web.Cach ing.CacheIntern al.DoInsert(Boo lean isPublic,
String key, Object value, CacheDependency dependencies, DateTime
utcAbsoluteExpi ration, TimeSpan slidingExpirati on, CacheItemPriori ty
priority, CacheItemRemove dCallback onRemoveCallbac k, Boolean replace)
at System.Web.Cach ing.Cache.Inser t(String key, Object value,
CacheDependency dependencies, DateTime absoluteExpirat ion, TimeSpan
slidingExpirati on, CacheItemPriori ty priority,
CacheItemRemove dCallback onRemoveCallbac k)

I've not seen this error before...and I couldn't find reference to
this error message either on Google or MSDN.
Does anyone know what could cause the
"Cache_dependen cy_used_more_th at_once" exception to happen.

Thanks
Mahesh

Feb 16 '07 #1
2 2415
Decompiled:

internal void MonitorDependen cyChanges()
{
CacheDependency dependency1 = this._dependenc y;
if ((dependency1 != null) && (this.State ==
CacheEntry.Entr yState.AddedToC ache))
{
if (!dependency1.U se())
{
throw new
InvalidOperatio nException(SR.G etString("Cache _dependency_use d_more_that_onc e"));
}
dependency1.Set CacheDependency Changed(this);
}
}

In other words, it is trying to use the dependency but it is alread in use
(probably from another part of your code is my guess).
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"ma***********@ gmail.com" wrote:
Hi,

I'm trying to add an object to the .NET cache using a CacheDependency
and I get the following exception :

System.InvalidO perationExcepti on: Cache_dependenc y_used_more_tha t_once
at System.Web.Cach ing.CacheEntry. MonitorDependen cyChanges()
at System.Web.Cach ing.CacheSingle .UpdateCache(Ca cheKey cacheKey,
CacheEntry newEntry, Boolean replace, CacheItemRemove dReason
removedReason, Object& valueOld)
at System.Web.Cach ing.CacheMultip le.UpdateCache( CacheKey cacheKey,
CacheEntry newEntry, Boolean replace, CacheItemRemove dReason
removedReason, Object& valueOld)
at System.Web.Cach ing.CacheIntern al.DoInsert(Boo lean isPublic,
String key, Object value, CacheDependency dependencies, DateTime
utcAbsoluteExpi ration, TimeSpan slidingExpirati on, CacheItemPriori ty
priority, CacheItemRemove dCallback onRemoveCallbac k, Boolean replace)
at System.Web.Cach ing.Cache.Inser t(String key, Object value,
CacheDependency dependencies, DateTime absoluteExpirat ion, TimeSpan
slidingExpirati on, CacheItemPriori ty priority,
CacheItemRemove dCallback onRemoveCallbac k)

I've not seen this error before...and I couldn't find reference to
this error message either on Google or MSDN.
Does anyone know what could cause the
"Cache_dependen cy_used_more_th at_once" exception to happen.

Thanks
Mahesh

Feb 16 '07 #2
Hi Peter,

Thanks for the reply! I was doing the following :

_cache.Insert(" dep","dependenc y");

string[] depKey = {"dep"};
CacheDependency cdep = new CacheDependency (null,depKey);

_cache.Insert(" 1","one",cdep,. ..);
_cache.Insert(" 2","two",cdep,. .);

I thought we could use the same CacheDependency object for more than
one keys; seems like we cannot (btw it would be interesting to know
why it was designed this way)
The code worked after I changed to this...

_cache.Insert(" dep","dependenc y");
string[] depKey = {"dep"};

CacheDependency cdep1 = new CacheDependency (null,depKey);
_cache.Insert(" 1","one",cdep1, ...);

CacheDependency cdep2 = new CacheDependency (null,depKey);
_cache.Insert(" 2","two",cdep2, ..);

Thanks again for your help.

-Mahesh

On Feb 16, 1:10 pm, Peter Bromberg [C# MVP]
<pbromb...@yaho o.yabbadabbadoo .comwrote:
Decompiled:

internal void MonitorDependen cyChanges()
{
CacheDependency dependency1 = this._dependenc y;
if ((dependency1 != null) && (this.State ==
CacheEntry.Entr yState.AddedToC ache))
{
if (!dependency1.U se())
{
throw new
InvalidOperatio nException(SR.G etString("Cache _dependency_use d_more_that_onc e"));
}
dependency1.Set CacheDependency Changed(this);
}

}

In other words, it is trying to use the dependency but it is alread in use
(probably from another part of your code is my guess).
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net

"mahesh.pra...@ gmail.com" wrote:
Hi,
I'm trying to add an object to the .NET cache using a CacheDependency
and I get the following exception :
System.InvalidO perationExcepti on: Cache_dependenc y_used_more_tha t_once
at System.Web.Cach ing.CacheEntry. MonitorDependen cyChanges()
at System.Web.Cach ing.CacheSingle .UpdateCache(Ca cheKey cacheKey,
CacheEntry newEntry, Boolean replace, CacheItemRemove dReason
removedReason, Object& valueOld)
at System.Web.Cach ing.CacheMultip le.UpdateCache( CacheKey cacheKey,
CacheEntry newEntry, Boolean replace, CacheItemRemove dReason
removedReason, Object& valueOld)
at System.Web.Cach ing.CacheIntern al.DoInsert(Boo lean isPublic,
String key, Object value, CacheDependency dependencies, DateTime
utcAbsoluteExpi ration, TimeSpan slidingExpirati on, CacheItemPriori ty
priority, CacheItemRemove dCallback onRemoveCallbac k, Boolean replace)
at System.Web.Cach ing.Cache.Inser t(String key, Object value,
CacheDependency dependencies, DateTime absoluteExpirat ion, TimeSpan
slidingExpirati on, CacheItemPriori ty priority,
CacheItemRemove dCallback onRemoveCallbac k)
I've not seen this error before...and I couldn't find reference to
this error message either on Google or MSDN.
Does anyone know what could cause the
"Cache_dependen cy_used_more_th at_once" exception to happen.
Thanks
Mahesh

Feb 16 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2245
by: peter greaves | last post by:
hi everyone i am having a bad time with an entity resolver. my application uses a resolver to locally-cache the nested schemas that the basic xsd includes to a local directory. however i am getting an exception when the parser tries to parse one of the included xsds which it has downloaded, because (as far as i can tell from the stack trace) it is trying but failing to handle other included xsds. the exception is here:
7
1894
by: Douglas Peterson | last post by:
Take a look at this code, it looks funny as its written to be as short as possible: -- code -- struct Base { ~Base() { *((char*)0) = 0; } }; struct Derived : public Base
1
1402
by: leodippolito | last post by:
Hello, I have these entities in my ASP.NET application: - data access layer (DATA) - custom exception class (EXCEPTION) - cache management class (CACHE) They're all built into different DLL's.
30
3381
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and commits it. How does the other user get the updated view without polling for changes? Is there some sort of callback mechanism that can be set up on the dataset or connection? TIA
0
1973
by: =?Utf-8?B?YmlqYXk=?= | last post by:
The type initializer for 'Microsoft.ApplicationBlocks.Cache.CacheService' threw an exception. We migrated our windows application from 1.1 to 2.0. The debug and Release mode of the application work fine with some tweaking. But when the setup project is migrated to 2.0 the installation gives the follwing error: - <ExceptionInformation> <AdditionalInformationProperty ExceptionManager.MachineName="TestDev"...
4
39697
by: =?Utf-8?B?YmlqYXk=?= | last post by:
We migrated our windows application from 1.1 to 2.0. The debug and Release mode of the application work fine with some tweaking. But when the setup project is migrated to 2.0 the installation gives the follwing error: Message:The type initializer for 'Microsoft.ApplicationBlocks.Cache.CacheService' threw an exception. - <ExceptionInformation>
4
3145
by: MikeB | last post by:
Hello All, I am trying to cache a menu that I dynamically build out and I do not want to have to build it out each time the page loads. Here is how I am doing it however, it doesnt work. Can anyone help? TIA if (Cache == null) { THIS IS WHERE I BUILD OUT THE MENU ITEMS
1
1195
by: ceestand | last post by:
I am having a weird (to me at least) problem retrieving a copy of an item in the Cache. I do something like this: DataTable ToBeInserted = FunctionThatReturnsDataTable(); Cache.Insert("CacheTable", ToBeInserted); public DataTable function() { DataTable Results = (DataTable)Cache; Results.Columns.Add("Rank"); return Results;
10
1847
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... We've been trying to migrate our asp.net apps off older, underpowered hardware to newer, bigger boxes but when we do, we see our databases start to melt. When I started to look into it, I found that the older boxes all had bigger EffectivePrivateBytesLimit values than the newer boxes, which seems very counter-intuitive to me. And it seemed to me that a much smaller Cache would be pushing more requests back to the databases.
0
8272
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8713
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8514
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7206
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6126
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4208
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.