diff --git a/projects/client/RabbitMQ.Client/src/client/api/IEndpointResolverExtensions.cs b/projects/client/RabbitMQ.Client/src/client/api/IEndpointResolverExtensions.cs index fb87668e57..16a528548a 100755 --- a/projects/client/RabbitMQ.Client/src/client/api/IEndpointResolverExtensions.cs +++ b/projects/client/RabbitMQ.Client/src/client/api/IEndpointResolverExtensions.cs @@ -49,7 +49,7 @@ public static class EndpointResolverExtensions public static T SelectOne(this IEndpointResolver resolver, Func selector) { var t = default(T); - Exception exception = null; + var exceptions = new List(); foreach(var ep in resolver.All()) { try @@ -62,13 +62,13 @@ public static T SelectOne(this IEndpointResolver resolver, Func 0) { - throw exception; + throw new AggregateException(exceptions); } return t; diff --git a/projects/client/RabbitMQ.Client/src/client/exceptions/BrokerUnreachableException.cs b/projects/client/RabbitMQ.Client/src/client/exceptions/BrokerUnreachableException.cs index 8aebb672b9..5eccd244da 100644 --- a/projects/client/RabbitMQ.Client/src/client/exceptions/BrokerUnreachableException.cs +++ b/projects/client/RabbitMQ.Client/src/client/exceptions/BrokerUnreachableException.cs @@ -47,8 +47,8 @@ namespace RabbitMQ.Client.Exceptions ///ConnectionFactory.CreateConnection attempt. public class BrokerUnreachableException : IOException { - ///Construct a BrokerUnreachableException. The inner exception is associated - ///with only one connection attempt. + ///Construct a BrokerUnreachableException. The inner exception is + ///an AggregateException holding the errors from multiple connection attempts. public BrokerUnreachableException(Exception Inner) : base("None of the specified endpoints were reachable", Inner) { diff --git a/projects/client/RabbitMQ.Client/src/client/impl/Connection.cs b/projects/client/RabbitMQ.Client/src/client/impl/Connection.cs index ae4daf0dd7..0b2e5de0ca 100644 --- a/projects/client/RabbitMQ.Client/src/client/impl/Connection.cs +++ b/projects/client/RabbitMQ.Client/src/client/impl/Connection.cs @@ -117,17 +117,6 @@ public class Connection : IConnection .InformationalVersion; #endif -#if CORECLR - private static string version = typeof(Connection).GetTypeInfo().Assembly - .GetCustomAttribute() - .InformationalVersion; -#else - private static string version = typeof(Connection).Assembly - .GetCustomAttribute() - .InformationalVersion; -#endif - - // true if we haven't finished connection negotiation. // In this state socket exceptions are treated as fatal connection // errors, otherwise as read timeouts diff --git a/projects/client/Unit/src/unit/TestIEndpointResolverExtensions.cs b/projects/client/Unit/src/unit/TestIEndpointResolverExtensions.cs index 9941d97644..20aaf689a4 100644 --- a/projects/client/Unit/src/unit/TestIEndpointResolverExtensions.cs +++ b/projects/client/Unit/src/unit/TestIEndpointResolverExtensions.cs @@ -79,7 +79,8 @@ public void SelectOneShouldReturnDefaultWhenThereAreNoEndpoints() public void SelectOneShouldRaiseThrownExceptionWhenThereAreOnlyInaccessibleEndpoints() { var ep = new TestEndpointResolver(new List { new AmqpTcpEndpoint()}); - Assert.Throws(() => ep.SelectOne((x) => { throw new TestEndpointException("bananas"); })); + var thrown = Assert.Throws(() => ep.SelectOne((x) => { throw new TestEndpointException("bananas"); })); + Assert.That(thrown.InnerExceptions, Has.Exactly(1).TypeOf()); } [Test]