Context
The generated client classes have a protected parameterless constructor intended for mocking, but it chains to a real overload that instantiates a live ManagedIdentityCredential and builds an HTTP pipeline.
Problem
// Current — KustoClient.cs (and all generated clients)
protected KustoClient() : this(new Uri("https://localhost")) { }
This calls KustoClient(Uri) → ConnectorClientBase(Uri) → creates new ManagedIdentityCredential(ManagedIdentityId.SystemAssigned) and calls HttpPipelineBuilder.Build(...). In CI/test environments without IMDS:
- The constructor may block waiting for the metadata endpoint
- Managed identity calls can introduce latency or throw on misconfigured machines
The base class already has a no-op constructor designed for exactly this case:
// ConnectorClientBase.cs
protected ConnectorClientBase()
{
this._pipeline = null!;
this._connectionRuntimeUrl = string.Empty;
}
Proposed change
Chain to the base no-op constructor instead:
// Fix — safe for mocking, no live resources created
protected KustoClient() : base() { }
This is a generator template change — applies to all 90+ generated client classes.
Azure SDK guideline
DO provide a protected no-argument constructor for mocking
Context
The generated client classes have a protected parameterless constructor intended for mocking, but it chains to a real overload that instantiates a live
ManagedIdentityCredentialand builds an HTTP pipeline.Problem
This calls
KustoClient(Uri)→ConnectorClientBase(Uri)→ createsnew ManagedIdentityCredential(ManagedIdentityId.SystemAssigned)and callsHttpPipelineBuilder.Build(...). In CI/test environments without IMDS:The base class already has a no-op constructor designed for exactly this case:
Proposed change
Chain to the base no-op constructor instead:
This is a generator template change — applies to all 90+ generated client classes.
Azure SDK guideline
DO provide a protected no-argument constructor for mocking