Hi,
My C# app uses ESL to interact with FS. It plays wav files via bgapi and receives and processes the events of the playbacks.  The listening thread is started like  ManagedESLTest program:

ThreadPool.QueueUserWorkItem(new WaitCallback(getFsEventsInboundMode));

this thread ends up in a while loop where the events are received:

                while (eslConnection.Connected() == ESL_SUCCESS && !stopConnection)
                {
                    eslEvent = eslConnection.RecvEventTimed(50); 
                    if (eslEvent != null)
                    {
                        onFreeswitcEvent(eslEvent );
                    }
                }
onFreeSwitchEvent calls ends up in an other thread.

bgapi commands is sent via the same eslConnection, I assume that the occasional Accessviolation at RecvEventTimed is caused by sending bgapi commands via the same eslConnection from an other thread. Could that be the cause?

Other related questions:
Is it safe to pass eslEvent to an other thread, or it should be serialized? If so is there a best practice to serialize?

Is there some kind of event buffer in eslConnection, or the RecvEvent misses all the events which "arrived" before the call?

Thank you in advance:
Ferenc