Skip to content

[Bug Report] RegistryManager.CreateQuery does not support cancellation tokens #3499

@detrepan3

Description

@detrepan3

Context

  • OS, version, SKU and CPU architecture used: Windows 11 Desktop x64,
  • Application's .NET Target Framework : net8.0
  • Device: N/A
  • SDK version used: Microsoft.Azure.Devices 1.40

Description of the issue

The RegistryManager.CreateQuery does not contain an input for a cancellation token. It seems like the code inside it just passed CancellationToken.None into all internal calls

Code sample exhibiting the issue

From Microsoft.Azure.Devices.RegistryManager

    public virtual IQuery CreateQuery(string sqlQueryString, int? pageSize)
    {
        if (Logging.IsEnabled)
        {
            Logging.Enter(this, $"Creating query", "CreateQuery");
        }

        try
        {
            return new Query((string token) => ExecuteQueryAsync(sqlQueryString, pageSize, token, CancellationToken.None)); // <--- This
        }
        catch (Exception ex)
        {
            if (Logging.IsEnabled)
            {
                Logging.Error(this, FormattableStringFactory.Create("{0} threw an exception: {1}", "CreateQuery", ex), "CreateQuery");
            }

            throw;
        }
        finally
        {
            if (Logging.IsEnabled)
            {
                Logging.Exit(this, $"Creating query", "CreateQuery");
            }
        }
    }

Console log of the issue

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions