Skip to content

Commit abde7e5

Browse files
Merge pull request #367 from rabbitmq/rabbitmq-dotnet-client-359
Include assembly informational version in client properties.
2 parents 557be74 + 139b91d commit abde7e5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

projects/client/RabbitMQ.Client/src/client/impl/Connection.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
using System.Text;
6161
using System.Threading;
62+
using System.Reflection;
6263

6364
namespace RabbitMQ.Client.Framing.Impl
6465
{
@@ -107,6 +108,16 @@ public class Connection : IConnection
107108
private AutoResetEvent m_heartbeatRead = new AutoResetEvent(false);
108109
private AutoResetEvent m_heartbeatWrite = new AutoResetEvent(false);
109110

111+
#if CORECLR
112+
private static string version = typeof(Connection).GetTypeInfo().Assembly
113+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
114+
.InformationalVersion;
115+
#else
116+
private static string version = typeof(Connection).Assembly
117+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
118+
.InformationalVersion;
119+
#endif
120+
110121

111122
// true if we haven't finished connection negotiation.
112123
// In this state socket exceptions are treated as fatal connection
@@ -354,9 +365,6 @@ IProtocol IConnection.Protocol
354365

355366
public static IDictionary<string, object> DefaultClientProperties()
356367
{
357-
358-
string version = "0.0.0.0";// assembly.GetName().Version.ToString();
359-
//TODO: Get the rest of this data from the Assembly Attributes
360368
IDictionary<string, object> table = new Dictionary<string, object>();
361369
table["product"] = Encoding.UTF8.GetBytes("RabbitMQ");
362370
table["version"] = Encoding.UTF8.GetBytes(version);

0 commit comments

Comments
 (0)