Azure / Azure/azure-iot-sdk-csharp
[Bug Report] DPS query API does not populate enrollment assignment information
- Dominant language
- C#
- Stars
- 477
- Forks
- 492
- Avg merge
- 9h 55m
- Merged PRs (30d)
- 2
Description
# Context
- **OS, version, SKU and CPU architecture used:** Windows 10 Desktop x64, Azure App Service (Linux based)
- **Application's .NET Target Framework :** net8.0
- **SDK version used:** Microsoft.Azure.Devices.Provisioning.Service 1.18.4
## Description of the issue
The DPS SDK contains wrapper methods around two DPS APIs:
(a) query all enrollments for a DPS instance
(b) get a single enrollment from the DPS instance
Method (b) works correctly, but when using version (a), the enrollment objects are all missing the `RegistrationState` information. This causes us to have to retrieve each individual enrollment rather than querying the list once and using the information as-is.
## Code sample exhibiting the issue
```
ProvisioningServiceClient provisioningServiceClient =
ProvisioningServiceClient.CreateFromConnectionString("");
IndividualEnrollment goodResult = await provisioningServiceClient.GetIndividualEnrollmentAsync("");
// here, goodResult.RegistrationState is a valid object containing IoT Hub assignment details
Query query = provisioningServiceClient.CreateIndividualEnrollmentQuery(new QuerySpecification(string.Empty));
while(query.HasNext())
{
QueryResult result = await query.NextAsync();
IReadOnlyList badResults = result.Items.OfType()
.Select(enrollment => enrollment.RegistrationState).ToList();
// here, every item in badResults will be null
}
```
Contributor guide
Research direction
Start with CreateIndividualEnrollmentQuery and QueryResult mapping, then compare the behavior with GetIndividualEnrollmentAsync using the supplied reproduction. Confirm whether query results populate IndividualEnrollment.RegistrationState; done means each returned enrollment includes the assignment information that the individual lookup provides.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100