Version property is not populated when using SendAsync

Hello,

I’m using ServiceStack 4.5.4 and I am trying to make the IHasVersion interface work for a specific request however the Version property is not automatically populated.

This is my request:

    [Route("/token/guest", Verbs = "GET")]
    public class GetTokenRequest : IReturn<Token>, IHasVersion
    {
        public DateTime ExpiryDate { get; set; }
        public int Version { get; set; }
    }

And I use it like this:

var client = new JsonServiceClient(url);
client.Version = 2;
var r = new GetTokenRequest();
var result = await client.SendAsync(r).ConfigureAwait(false);

The version property of the request is not populated with the version number of the client and using Fiddler I can see that the version property is sent with a value of 0.

If I use Send instead of SendAsync the version property is populated correctly so it looks like the async implementation has bug (or I am doing something wrong).

I’ve just added some tests that shows its working in both JsonServiceClient and JsonHttpClient so it must already have been resolved in a later release.

Your test is slightly different that what I had above. Can you try this one:

                [Test]
                public async Task Does_send_version_using_JsonServiceClient()
                {
                    var client = new JsonServiceClient(Config.AbsoluteBaseUri);
                    client.Version = 1;
                    var response = client.Send(new RequestWithVersion { });
                    Assert.That(response.Version, Is.EqualTo(1));
            
                    response = await client.SendAsync(new RequestWithVersion {  });
                    Assert.That(response.Version, Is.EqualTo(1));
                }

According to the documentation, setting the version on the client should populate the version on the request but it does not even with the latest stable version 4.5.12. CustomMethod and CustomMethodAsync have the same issue.

Yep sorry misread the code, should be fixed in this commit.

Thanks for the fix. Do you know when the next stable version will be released?

It is here :slight_smile: http://docs.servicestack.net/releases/v4.5.14

I can confirm that Send and SendAsync works as expected in 4.15.14 however CustomMethod and CustomMethodAsync still have the issue (I briefly mentioned them in a reply above).

I would like to add that the CustomMethod and CustomMethodAsync methods adds the version to the request for POST request but not for GET request (I didn’t test PUT or DELETE).

Can you try with the latest v4.5.15 on MyGet.

I tried the latest v4.5.15 available on MyGet (I cleared my Nuget cache before doing so) but I still have the issue. I decompiled the Dll however I cannot see the changes from your commit. Is it possible that MyGet does not have the latest version of the code?

If MyGet has the old .dlls it’s possible I forgot to publish, I’ve just finished redeploying to MyGet again.

I can confirm that the new v4.5.15 package fixed the issue with CustomMethod and CustomMethodAsync.

Thanks!

1 Like