L
La07K
Guest
Hello I am getting this error even though i initialized the dictionary.Dont know how its happening? please find my code snippet below.
callbackMap = new Dictionary<Guid, myCallback>()
public void RegisterCb(Guid id, Callback cb)
{
if (callbackMap == null)
{
//here i am logging but there is no log entry.that means this point of time its not null
}
if (callbackMap.ContainsKey(context))
{
// replace previous callback
callbackMap[id] = cb;
}
else
{
callbackMap.Add(id, cb);
}
}
This issue is not happening always,sporadically happens.I am calling separately only.I have doubt here if i am putting a lock then this will solve???
Can anyone help me to slove this???
But in the caller functions catch block there is a log entry like
TargetSite = Insert
Exception = Object reference not set to an instance of an object.
CallStack = at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at xxxx.RegisterCb(Guid id, Callback cb)
Coding.....................................
Continue reading...
callbackMap = new Dictionary<Guid, myCallback>()
public void RegisterCb(Guid id, Callback cb)
{
if (callbackMap == null)
{
//here i am logging but there is no log entry.that means this point of time its not null
}
if (callbackMap.ContainsKey(context))
{
// replace previous callback
callbackMap[id] = cb;
}
else
{
callbackMap.Add(id, cb);
}
}
This issue is not happening always,sporadically happens.I am calling separately only.I have doubt here if i am putting a lock then this will solve???
Can anyone help me to slove this???
But in the caller functions catch block there is a log entry like
TargetSite = Insert
Exception = Object reference not set to an instance of an object.
CallStack = at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at xxxx.RegisterCb(Guid id, Callback cb)
Coding.....................................
Continue reading...