microsoft/aspire · error · DistributedApplicationException

The MAUI OTLP endpoint could not be determined within

Error message

The MAUI OTLP endpoint could not be determined within {resolutionTimeout:c}.

What it means

The MAUI OTLP endpoint (e.g., a device tunnel or forwarded endpoint) could not be resolved within the resolution timeout. The code awaits an endpoint reference value (such as a tunnel endpoint) with a timeout, and when the wait is cancelled by that timeout rather than caller cancellation, it rethrows as a DistributedApplicationException.

Solutions

  1. Increase the resolution timeout if device/tunnel startup is legitimately slow.
  2. Verify the target device/emulator is connected and the tunnel resource started successfully.
  3. Check the tunnel endpoint resource logs for bind/forwarding failures.
  4. Ensure the dashboard/runtime is running so the endpoint can be published at all.

Example fix

// before
// default short timeout on a slow cold-booted emulator
// after
// configure a larger resolution timeout before resolving the endpoint
options.ResolutionTimeout = TimeSpan.FromMinutes(3);
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure the tunnel/forwarding resource is running before resolving
if (deviceResource.State is not RunningState)
    throw new InvalidOperationException("Device tunnel resource is not running; endpoint cannot resolve.");

Try / catch

try
{
    var endpoint = await tunnelEndpoint.GetValueAsync(timeoutCts.Token);
}
catch (DistributedApplicationException ex) when (ex.Message.Contains("MAUI OTLP endpoint could not be determined"))
{
    logger.LogWarning(ex, "MAUI OTLP endpoint not available within timeout");
}

Prevention

When it happens

Trigger: Calling GetValueAsync on the MAUI OTLP endpoint reference while the underlying tunnel/device endpoint never becomes available within resolutionTimeout — e.g., device not connected, tunnel resource not running, or endpoint never published.

Common situations: Android/iOS device not plugged in or emulator offline, ADB/tunnel forwarding not yet established, slow device boot, or the tunnel resource failed to start so the endpoint is never published.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/78ea91faab053d59. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Maui/MauiOtlpExtensions.cs:591

        {
            using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
            timeoutCts.CancelAfter(resolutionTimeout);

            try
            {
                // Wait for target resolution first so its failure is propagated immediately instead
                // of leaving the public tunnel endpoint pending until application cancellation.
#pragma warning disable CS0618 // Type or member is obsolete
                await targetEndpoint.AllocatedEndpointSnapshot
                    .GetValueAsync(timeoutCts.Token)
                    .ConfigureAwait(false);
#pragma warning restore CS0618 // Type or member is obsolete

                return await tunnelEndpoint.GetValueAsync(timeoutCts.Token).ConfigureAwait(false);
            }
            catch (OperationCanceledException ex) when (!cancellationToken.IsCancellationRequested)
            {
                throw new DistributedApplicationException(
                    $"The MAUI OTLP endpoint could not be determined within {resolutionTimeout:c}.",
                    ex);
            }
        }
    }

    private sealed class OtlpProtocolValueProvider(
        EndpointAnnotation endpoint,
        TimeSpan resolutionTimeout) : IValueProvider
    {
        public async ValueTask<string?> GetValueAsync(CancellationToken cancellationToken = default)
        {
            try
            {
#pragma warning disable CS0618 // Type or member is obsolete
                await endpoint.AllocatedEndpointSnapshot
                    .GetValueAsync(cancellationToken)
                    .WaitAsync(resolutionTimeout, cancellationToken)

View on GitHub (pinned to 25830f84bd)