[Mono-dev] Bug in System.Web.Caching.Get() / Timer.Change() ?

jriepshoff at ujam.com jriepshoff at ujam.com
Mon Nov 22 09:05:18 EST 2010


Dear all,

on running Stress Test on our program, we encountered following exception:

System.ArgumentException: Key 'System.Threading.Timer' already exists in list.
  at System.Collections.SortedList.PutImpl (System.Object key, System.Object value, Boolean overwrite) [0x00000] in <filename unknown>:0 
  at System.Collections.SortedList.Add (System.Object key, System.Object value) [0x00000] in <filename unknown>:0 
  at System.Threading.Timer+Scheduler.Add (System.Threading.Timer timer) [0x00000] in <filename unknown>:0 
  at System.Threading.Timer+Scheduler.Change (System.Threading.Timer timer, Int64 new_next_run) [0x00000] in <filename unknown>:0 
  at System.Threading.Timer.Change (Int64 dueTime, Int64 period, Boolean first) [0x00000] in <filename unknown>:0 
  at System.Threading.Timer.Change (Int64 dueTime, Int64 period) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Threading.Timer:Change (long,long)
  at System.Web.Caching.Cache.Get (System.String key) [0x00000] in <filename unknown>:0 


This happens when we look something up in the Caching object....


I looked the Get() function up via Assembly Browser in Monodevelop. The error causing part of it looks as follows:



public object Get(string key)
{

  ...

	if (V_1.SlidingExpiration != Cache.NoSlidingExpiration)
	{
		V_1.AbsoluteExpiration = DateTime.get_Now() + V_1.SlidingExpiration;
		// THE FOLLOWING LINE SEEMS TO CAUSE THE ERROR
		V_1.Timer.Change((long)&V_1.SlidingExpiration.get_TotalMilliseconds(), (long)-1);
	}

....

}




Has this already been addressed somehow? Can we consider this as "in development"?



Best
Jan






More information about the Mono-devel-list mailing list