Empty (null) Activity Log using Octopus.Client

Hi

Using Octopus.Client NuGet package (4.5.2), I’m not able to get the Activity Log of an ad-hoc task I’ve created.

I do something like this to create and execute an AdHoc Task:

const string helloWordPsScript = "Write-Host \"Hello World!\"";
var endpoint = new OctopusServerEndpoint(<endpointUrl>, <apiKey>);
var repository = new OctopusRepository(endpoint);
var taskResource = repository.Tasks.ExecuteAdHocScript(helloWordPsScript, new [] { <devServerMachineId> });

This seems to work great. After the task has completed (a few seconds in this case) I can see the Task Log on the Octopus front end.
And if I request the details over the raw API like
GET <endpointUrl>/api/tasks/<taskId>/details
I can also see the Activity Log.

However, if I use Octopus.Client to get the Task details like so:
var taskDetailResource = repository.Tasks.GetDetails(taskResource);
then taskDetailResource.ActivityLogs is null.

Is there something I’m missing here, or is this a bug in Octopus.Client?

Thanks

Hi Giles,

Thanks for getting in touch.

I’ve tried to reproduce the issue you are seeing but I’m not having any luck. When I create an ad-hoc task and retrieve details for the task I am getting back ActivityLogs. I am using 4.5.2 client and the 4.7.13 Octopus Server. Can I ask what version of Octopus Server you are using in case there is a backwards compatibility issue?

Cheers,
Shane

Hi Shane

Thanks for getting back to me.

It appears I’m using an old version of Octopus - front end reports 3.0.23.0.

So I’ve downgraded Octopus.Client all the way to 3.0.26 (most recent 3.0.x version) and it looks like that will sort it out.

It looks like there was a change some time during version 3 that changed “ActivityLog” to “ActivityLogs” in the raw JSON response. I suspect this was by design and I should’ve been using a compatible NuGet version all along! (I’m not sure if the documentation makes reference to that or not.)

So thanks for pointing me in the right direction.

Giles

Hi Giles,

We go to a lot of effort to maintain backwards compatibility between our tooling versions and Octopus Server versions: you should be able to use any 3.x Octopus.Client with 3.x Octopus Server.

It looks like ActivityLog was changed to ActivityLogs in version 3.4 which is causing the behaviour you are seeing. I’m going to update the release notes for 3.4 with a breaking change and we are working on better ways to communicate changes to our tools so hopefully in future it will be clearer why something like this is happening.

Cheers,
Shane