locked
SchedulerClient.Jobs.List - ArgumentOutOfRangeException: Specified argument was out of the range of valid values. RRS feed

  • Question

  • Hi,

    I started working with the Azure scheduler using the Nuget management package and I run into an issue with SchedulerClient.Jobs.List function - regardless of what parameters I'm passing it throws an "ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: value".

    See below a code snippet for how I'm using it. I'm able to create jobs, they execute OK against a storage queue, I'm also able to retrieve individual job details and associated history, but I can't figure why 'List' won't work. 

                string subscriptionId = ConfigurationManager.AppSettings["Azure.SubscriptionId"];
                string managementCertificate = ConfigurationManager.AppSettings["Azure.ManagementCertificate"];
    
                var certificate = new X509Certificate2(Convert.FromBase64String(managementCertificate));
                var cloudCredentials = new Microsoft.WindowsAzure.CertificateCloudCredentials(subscriptionId, certificate);
    
                var schedulerClient = new SchedulerClient(cloudCredentials, _cloudServiceName, _jobCollectionName);
    
                var jobsListRsp = schedulerClient.Jobs.List(new JobListParameters() { State=JobState.Enabled, Top=10 });
                foreach (var job in jobsListRsp.Jobs)
                {
                    Trace.TraceInformation("Job: {0} - Action: {1} - State: {2} - Status: {3}", job.Id, job.Action, job.State, job.Status);
                }

    Any ideas? It looks more like a bug in the Nuget library to me ...

    Thanks

    • Edited by Florin Neamtu Sunday, December 8, 2013 4:11 PM more info
    Sunday, December 8, 2013 4:09 PM

All replies

  • An updated nuget package including the Scheduler SDK was published on Dec 9.

    Could you pick that up and retry?  In the case where you get an exception, the stack trace would be helpful.

    Wednesday, December 11, 2013 6:52 PM
  • I'm afraid the new package throws the same exception, and not much in the stack trace. Same code as above used, I run it from a MS unit test.

    Not sure if this would be of any help: I found that the Azure portal now offers 'some' support for Scheduler and can display the job collections, but the portal fails too when I'm trying to view the list of jobs from a job collection (same as I'm trying in the code above).

    Result Message:
    Test method LiveServices.Infrastructure.AzureSchedulerTests.GetScheduledJobs threw exception: 
    System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    Parameter name: value
    Result StackTrace:
    at Microsoft.WindowsAzure.Scheduler.JobOperationsExtensions.List(IJobOperations operations, JobListParameters parameters)
       at LiveServices.Infrastructure.AzureSchedulerTests.GetScheduledJobs() in d:\LiveDentix\LiveServices\Unit Testing\LiveServicesTests\Inventory Infrastructure\Infrastructure.AzureScheduler.cs:line 217


    Saturday, December 14, 2013 6:16 PM
  • ... but this morning SchedulerClient.Jobs.List started working! I suspect some new Azure Scheduler release related to the portal support for Scheduler made it through! So after all the problem was probably not related to the client library.

    Sunday, December 15, 2013 1:56 PM
  • Well, apparently my last message proved to be no more than a lucky accident. What seems to happen is that if I don't pass Top at all in JobListParameters or if I pass it a value larger than the number of jobs in the collection, the ArgumentOutOfRangeException is still raised. So if the call looks like below and there are 16 or less jobs in the collection, the call will fail with the aforementioned exception. If there are 17 or more the call will succeed!

    var jobsListRsp = schedulerClient.Jobs.List(new JobListParameters() { State = JobState.Enabled, Top = 16 });
    I watched the traffic in Fiddler and everything seems fine from the service point of view, i.e. the request is formed correctly, the service returns correctly the JSON for the requested jobs. So it looks to me that the exception is raised mistakenly by the Nuget client package when it attempts to wrap the returned result.
    Sunday, December 15, 2013 4:36 PM
  • Florin -- I just tested this and found that indeed the SDK had not been updated.  Sorry for the misunderstanding.

    Please get 0.9.5-preview via nugget, just published, incorporating this fix.  This changes the filter to Jobs.ListWithFilter, taking the type JobListWithFilterParameters. If you don't want to filter on state, just pick Jobs.List.

    I am not seeing the Top behavior you mention.  Give the new SDK a try and if the behavior continues we can debug further.


    Monday, December 16, 2013 9:39 PM
  • Thanks for that, Jobs.List seems fine so far with the new SDK!

    Tuesday, December 17, 2013 12:46 AM
  • Sunday, December 22, 2013 1:06 AM