Skip to content

Service methods should return Response<T> not T directly #154

@daviburg

Description

@daviburg

Context

All generated service methods return Task<T> directly (e.g., Task<Table>, Task<VisualizeResults>). The Azure SDK for .NET design guidelines require wrapping results in Azure.Response<T> so callers can inspect HTTP metadata without catching exceptions.

Problem

// Current — raw T, HTTP metadata lost on success
public virtual async Task<Table> ListKustoResultsAsync(QueryAndListSchema input, CancellationToken cancellationToken = default)

// Guideline — Response<T> gives callers headers, request-ID, status code
public virtual async Task<Response<Table>> ListKustoResultsAsync(QueryAndListSchema input, CancellationToken cancellationToken = default)

Without Response<T>:

  • Callers cannot read x-ms-request-id from successful responses (needed for support tickets)
  • Callers cannot inspect the HTTP status code without catching ConnectorException
  • The SDK diverges from every other Azure.* client package's API shape

What's available

CallConnectorAsync<TResponse> already has message.Response available — it is currently discarded after deserialization. Returning Response.FromValue(deserializedValue, message.Response) requires a one-line change per overload in ConnectorClientBase.

Impact

Breaking change — changes the return type of every generated service method. Since the package is pre-1.0, this can ship as a breaking change in the next version. Coordinate with the Node SDK (same gap tracked in that repo).

Azure SDK guideline

DO return Azure.Response<T> from service client methods

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions