mikehadlow/EasyNetQ — pull request #84 by Pliner (2013-05-21 05:10:14+00:00)
Title: Imho, concurrent bug :)

I subscribed to KERegistrationMessage as follow:

Bus.SubscribeAsync("consumer", x => Task.Factory.StartNew(() => Register(x)));

private void Register(KERegistrationMessage message)
{
throw new Exception();
}

So, then I published about 10 messages and subscribe's callback was called, I've got an error in my log:

2013-05-21 10:56:22,877 29555 9 ERROR SKBKontur.Evrika.RabbitMQClient.Configuration.Log4NetLogger {log4net:HostName=pliner} EasyNetQ Consumer Error Handler: Failed to publish error message
Exception is:
System.ArgumentException: An item with the same key has already been added.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at EasyNetQ.DefaultConsumerErrorStrategy.DeclareErrorExchangeAndBindToDefaultErrorQueue(IModel model, String originalRoutingKey)
at EasyNetQ.DefaultConsumerErrorStrategy.HandleConsumerError(BasicDeliverEventArgs devliverArgs, Exception exception)

It seems that DefaultConcumerErrorStrategaty has a concurrent bug.

So, I think this changes will fix this problem :)