nats-io / nats.net.v2

Full Async C# / .NET client for NATS

Home Page:https://nats-io.github.io/nats.net.v2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Version number of client library always set to 1.0.0

darkwatchuk opened this issue · comments

Observed behavior

When asking the server for client connections, the version of the this library always comes back as 1.0.0, whereas other libraries come back with the correct versions. E.g.

NATS CLI Version 0.1.4 is go 1.33.1

Also, would it not be better for the language of the library to be reported as .NET rather than C# as per V1 of the library?

Issues with both .NET framework and Core

Expected behavior

I'd expect the library version to get reported correctly ideally with .NET as the library name, rather than C#.
e.g. .NET 2.3.0

Server and client version

.net client 2.3
server 2.10.16

Host environment

Windows client

Steps to reproduce

No response

commented

'supposed' to get it from the assembly!?

private static string GetAssemblyVersion()
{
var asm = typeof(ClientOpts);
var version = "1.0.0";
var infoVersion = asm!.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
if (infoVersion != null)
{
version = infoVersion.InformationalVersion;
}
else
{
var asmVersion = asm!.GetCustomAttribute<AssemblyVersionAttribute>();
if (asmVersion != null)
{
version = asmVersion.Version;
}
}
return version;
}

I don't think those attributes go on to the type.
If you change to
var asm = typeof(ClientOpts).Assembly;

Then it does work, however may be choose AssemblyFileVersionAttribute instead or AssemblyInformationalVersionAttribute, otherwise you get a GUID embedded in the version number?

image

commented

thanks @darkwatchuk that sounds like the solution to me 💯