Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Querying jobs from some IoT Hubs returns an unexpected ArgumentException #3352

Closed
matthewshan opened this issue Jul 17, 2023 · 5 comments
Assignees
Labels
area-service Issue points to a problem in the service. bug Something isn't working. IoTSDK Tracks all IoT SDK issues across the board

Comments

@matthewshan
Copy link

matthewshan commented Jul 17, 2023

Context

  • OS, version, SKU and CPU architecture used: Windows 10 Enterprise | Intel(R) Core(TM) i7-10750H (I am also observing this issue on an Azure Function app running on windows)
  • Application's .NET Target Framework : net6.0
  • Device: Laptop
  • SDK version used: 1.39.0 (Please include the NuGet package version for all involved components)

Description of the issue

When attempting to query a list of jobs from one of our IoT Hubs, I get "Requested value 'unknown' was not found." I see this error for some IoT Hubs, whereas others do not. After hours of debugging, I cannot identify the differentiating factors. One s1 iot hub allows for this code, and a different s1 and one free tier iot hub produces this error.

I double-checked to see that all my jobs have the status of completed and the type of scheduleUpdateTwin on all of these hubs

Code sample exhibiting the issue

public async Task<List<JobResponse>> GetActiveJobs(string connectionString)
    {
        var jobClient = JobClient.CreateFromConnectionString(connectionString);
        var query = jobClient.CreateQuery(jobType: JobType.ScheduleUpdateTwin, jobStatus: JobStatus.Running);

        var activeJobs = new List<JobResponse>();
        while (query.HasMoreResults)
        {
            var result = await query.GetNextAsJobResponseAsync(); // <-- Error is thrown on this line
            if (result != null)
            {
                activeJobs.AddRange(result);
            }
        }

        await jobClient.CloseAsync();

        return activeJobs;
    }

Console log of the issue

System.ArgumentException: Requested value 'unknown' was not found.
   at System.Enum.TryParseByName(RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt64& result)
   at System.Enum.TryParseInt32Enum(RuntimeType enumType, ReadOnlySpan`1 value, Int32 minInclusive, Int32 maxInclusive, Boolean ignoreCase, Boolean throwOnFailure, TypeCode type, Int32& result)
   at System.Enum.TryParse(Type enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
   at System.Enum.Parse(Type enumType, String value)
   at Microsoft.Azure.Devices.QueryResult.FromHttpResponseAsync(HttpResponseMessage response)
   at Microsoft.Azure.Devices.JobClient.GetJobsAsync(Nullable`1 jobType, Nullable`1 jobStatus, Nullable`1 pageSize, String continuationToken, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Query.GetNextAsync(QueryOptions options)
   at Microsoft.Azure.Devices.Query.GetAndCastNextResultAsync[T](QueryResultType type, QueryOptions options)
   at Microsoft.Azure.Devices.Query.GetNextAsJobResponseAsync(QueryOptions options)
   at Microsoft.Azure.Devices.Query.GetNextAsJobResponseAsync()
   at TestProject.Libraries.IotJobsHelper.GetJobs(String connectionString) in IotJobsHelper.cs:line 40
   at Program.<Main>$(String[] args) in Program.cs:line 8

Tasks

No tasks being tracked yet.
@matthewshan matthewshan added the bug Something isn't working. label Jul 17, 2023
@github-actions github-actions bot added the IoTSDK Tracks all IoT SDK issues across the board label Jul 17, 2023
@matthewshan
Copy link
Author

Bump

@timtay-microsoft timtay-microsoft self-assigned this Oct 18, 2023
@timtay-microsoft
Copy link
Member

timtay-microsoft commented Oct 18, 2023

The service side of this has changed lately, and it's possible that this bug is because of that. I'll follow up with the service engineers to see if something was broken here.

@timtay-microsoft
Copy link
Member

Service side engineers have confirmed that this is a bug that they are working to fix. You should get this fix as soon as the service team deploys it. Since this isn't an SDK-side bug, I'll go ahead and close this thread.

@timtay-microsoft timtay-microsoft added the area-service Issue points to a problem in the service. label Dec 1, 2023
@matthewshan
Copy link
Author

matthewshan commented Jan 8, 2024

@timtay-microsoft Thanks for the update! I'm unfortunately still seeing this as an issue. Is there a ticket on their end we can use to track this issue, or any news feeds I should pay attention to?

@timtay-microsoft
Copy link
Member

If you open a ticket through the Azure portal, you should be able to getter a better picture of when the service team will have this fix rolled out to your hub. We don't really track service-side updates in this or any other SDK repo, unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-service Issue points to a problem in the service. bug Something isn't working. IoTSDK Tracks all IoT SDK issues across the board
Projects
None yet
Development

No branches or pull requests

2 participants