Azure / azure-libraries-for-net

Azure libraries for .Net
MIT License
380 stars 192 forks source link

[BUG] TriggeredJobRun does not get populated altrough data is been shipped from Azure. #1052

Open Edward-Moll opened 4 years ago

Edward-Moll commented 4 years ago

Describe the bug When using the SDK the TriggeredJobRun container is not getting populated except for the "Name" and "Id" field.

Validated the data stream with fiddler and the data is comming in including the output_url (where we seeking for)

Altrough the result still is null of most/rest of the fields.

To Reproduce call any of the "TriggeredWebJobs" routines to pull the data and result of TriggeredJobRun will have null values except for ID and Name.

yungezz commented 4 years ago

hi @FourVision could you share what SDK and version you're using?

Edward-Moll commented 4 years ago

Hi @yungezz ,

We are using V1.33.0 of nuget package Microsoft.Azure.Management.Fluent

Example code for testing used that is not working:

Issue: the latestRun object is initialized but only contains the Name and Id value, all other object values are null. when analyzing the data flow from the REST API call it is populated. Other scenarios (using history list etc) are all showing the same result in the null values not been populated.

using Microsoft.Azure.Management.AppService.Fluent; using Microsoft.Azure.Management.AppService.Fluent.Models; using Microsoft.Azure.Management.Fluent;

            // Get azure worker
            IAzure azure = GetAzureConnector(apiConnector);

            TriggeredWebJobInner webJob = azure.WebApps.Inner.GetTriggeredWebJobAsync(custLicense.EntitlementId.ToString(), customerWebApp.Id.ToString(), "BackgroundRunner").Result;

            TriggeredJobRun latestRun = webJob.LatestRun;

            if (latestRun.OutputUrl != null)
            {
                //Download log
            }

            //Todo: Needs rework when API call is fixed!!!
            var year = Convert.ToInt32(webJob.LatestRun.Id.Substring(0, 4));
            var month = Convert.ToInt32(webJob.LatestRun.Id.Substring(4, 2));
            var day = Convert.ToInt32(webJob.LatestRun.Id.Substring(6, 2));
            var hour = Convert.ToInt32(webJob.LatestRun.Id.Substring(8, 2));
            var min = Convert.ToInt32(webJob.LatestRun.Id.Substring(10, 2));
            var sec = Convert.ToInt32(webJob.LatestRun.Id.Substring(12, 2));

            batchStatus.LastRun = new DateTime(year, month, day, hour, min, sec);

            batchStatus.Schedule = $"{webJob.Settings["schedule"]}";