Subject: Dictionary key problem on reconnect
I recently saw this running through my console. I was running my APP that connects to Cisco CIMP using XMPP, and connectivity was lost because I was debugging. My app is written to reconnect if the server is still up, which is the case here (it's just that if I take too long proceeding in the debugger, the connection interrupts).
So, I got this stacktrace
The last line is my code, a simple ConnectAsync
I haven't looked at the Matrix code yet, but that shouldn't be happening, right?
So, I got this stacktrace
15:39:55.246 Unable to connect to srvccx12.nxodev.intra: An item with the same key has already been added. Key: System.Func`2[Matrix.Xml.XmppXElement,System.Boolean] at at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Matrix.Network.Handlers.XmppStanzaHandler.Handle(Func`2 predicate, Action`2 action)
at Matrix.Network.Handlers.XmppStanzaHandler.SendAsync[T](Func`1 sendTask, Func`2 predicate, Int32 timeout, CancellationToken cancellationToken)
at Matrix.Network.Handlers.XmppStanzaHandler.SendAsync[T1,T2](String s, Int32 timeout, CancellationToken cancellationToken)
at Matrix.XmppConnection.SendAsync[T1,T2](String data, Int32 timeout, CancellationToken cancellationToken)
at Matrix.XmppConnection.SendStreamHeaderAsync(Int32 timeout, CancellationToken cancellationToken)
at Matrix.XmppConnection.SendStreamHeaderAsync(CancellationToken cancellationToken)
at Matrix.XmppClient.ConnectAsync(CancellationToken cancellationToken)
at Matrix.XmppClient.ConnectAsync()
at CiscoXmppLib.XmppConnector.Login(Boolean retryOnError, Boolean aquireLock) in D:\Personal\Documents\Visual Studio 2012\Projects\CiscoFinesseTest\CiscoXmppLib\XmppConnector.cs:line 446
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Matrix.Network.Handlers.XmppStanzaHandler.Handle(Func`2 predicate, Action`2 action)
at Matrix.Network.Handlers.XmppStanzaHandler.SendAsync[T](Func`1 sendTask, Func`2 predicate, Int32 timeout, CancellationToken cancellationToken)
at Matrix.Network.Handlers.XmppStanzaHandler.SendAsync[T1,T2](String s, Int32 timeout, CancellationToken cancellationToken)
at Matrix.XmppConnection.SendAsync[T1,T2](String data, Int32 timeout, CancellationToken cancellationToken)
at Matrix.XmppConnection.SendStreamHeaderAsync(Int32 timeout, CancellationToken cancellationToken)
at Matrix.XmppConnection.SendStreamHeaderAsync(CancellationToken cancellationToken)
at Matrix.XmppClient.ConnectAsync(CancellationToken cancellationToken)
at Matrix.XmppClient.ConnectAsync()
at CiscoXmppLib.XmppConnector.Login(Boolean retryOnError, Boolean aquireLock) in D:\Personal\Documents\Visual Studio 2012\Projects\CiscoFinesseTest\CiscoXmppLib\XmppConnector.cs:line 446
The last line is my code, a simple ConnectAsync
var connected = await xmppClient.ConnectAsync().ConfigureAwait(false);
I haven't looked at the Matrix code yet, but that shouldn't be happening, right?