While using LogicalCallContext
to share some data across threads we came across an exception with the below stack trace
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Hashtable.HashtableEnumerator.MoveNext()
at System.Runtime.Remoting.Messaging.LogicalCallContext.Merge(LogicalCallContext lc)
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
I read from MSDN when EndInvoke
is called CallContext
is merged across threads.
My question is doesn't the Hashtable inside CallContext
support concurrency. If it doesn't support should we be using CallContext
at the first point? If yes are there any guidelines for this.
Can anyone explain when can i see this stack trace?
an example for such scenario is more helpful if u can share.