.NET client: System.ArgumentNullException: Key cannot be null
699967May 19 2009 — edited May 28 2009I am creating continuous queries over a near-cache to generate a key set, and then retrieving the corresponding values directly from the near-cache. This process works correctly under java (against the same cache and dataset), but using the .NET client an exception is thrown. Simplified C# code:
private readonly INamedCache cache = CacheFactory.GetCache("test-cache");
private void Test() {
//create and evaluate some simple filters
IFilter f1 = new EqualsFilter("getValue", "A");
IFilter f2 = new EqualsFilter("getValue", "B");
IFilter f3 = new EqualsFilter("getValue", "C");
Evaluate(f1);
Evaluate(f2);
Evaluate(f3);
Evaluate(new OrFilter(f1, f2));
}
private void Evaluate(IFilter filter) {
//create continuous query cache and get its key set
ContinuousQueryCache cqc = new ContinuousQueryCache(cache, filter, false);
Object[] keys = cqc.GetKeys(null);
//get values from underlying cache
IDictionary values = nearCache.GetAll(keys); // exception on fourth call
}
At the point of executing Evaluate(...) on the final query the client throws an exception:
Unhandled Exception: System.InvalidOperationException: Synchronization error ---> System.ArgumentNullException: Key cannot be null.
Parameter name: key
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at System.Collections.Hashtable.Add(Object key, Object value)
at Tangosol.Util.LiteDictionary.Add(Object key, Object value) in c:\dev\release.net\coherence-net-v3.4
...etc etc...
Other observations:
1. The order the queries is executed in does not matter; the fourth query is always the one that fails
2. Replacing the OrFilter() with a simple EqualsFilter eliminates the problem
Any insight is appreciated.
Regards
Matt