{"record":{"id":"78ea91faab053d59","repo":"microsoft/aspire","slug":"the-maui-otlp-endpoint-could-not-be-determined-within","errorCode":null,"errorMessage":"The MAUI OTLP endpoint could not be determined within {resolutionTimeout:c}.","messagePattern":"The MAUI OTLP endpoint could not be determined within (.+?)\\.","errorType":"exception","errorClass":"DistributedApplicationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Maui/MauiOtlpExtensions.cs","lineNumber":591,"sourceCode":"        {\n            using var timeoutCts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);\n            timeoutCts.CancelAfter(resolutionTimeout);\n\n            try\n            {\n                // Wait for target resolution first so its failure is propagated immediately instead\n                // of leaving the public tunnel endpoint pending until application cancellation.\n#pragma warning disable CS0618 // Type or member is obsolete\n                await targetEndpoint.AllocatedEndpointSnapshot\n                    .GetValueAsync(timeoutCts.Token)\n                    .ConfigureAwait(false);\n#pragma warning restore CS0618 // Type or member is obsolete\n\n                return await tunnelEndpoint.GetValueAsync(timeoutCts.Token).ConfigureAwait(false);\n            }\n            catch (OperationCanceledException ex) when (!cancellationToken.IsCancellationRequested)\n            {\n                throw new DistributedApplicationException(\n                    $\"The MAUI OTLP endpoint could not be determined within {resolutionTimeout:c}.\",\n                    ex);\n            }\n        }\n    }\n\n    private sealed class OtlpProtocolValueProvider(\n        EndpointAnnotation endpoint,\n        TimeSpan resolutionTimeout) : IValueProvider\n    {\n        public async ValueTask<string?> GetValueAsync(CancellationToken cancellationToken = default)\n        {\n            try\n            {\n#pragma warning disable CS0618 // Type or member is obsolete\n                await endpoint.AllocatedEndpointSnapshot\n                    .GetValueAsync(cancellationToken)\n                    .WaitAsync(resolutionTimeout, cancellationToken)","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Maui/MauiOtlpExtensions.cs#L573-L609","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Increase the resolution timeout if device/tunnel startup is legitimately slow.","Verify the target device/emulator is connected and the tunnel resource started successfully.","Check the tunnel endpoint resource logs for bind/forwarding failures.","Ensure the dashboard/runtime is running so the endpoint can be published at all."],"exampleFix":"// before\n// default short timeout on a slow cold-booted emulator\n// after\n// configure a larger resolution timeout before resolving the endpoint\noptions.ResolutionTimeout = TimeSpan.FromMinutes(3);","handlingStrategy":"try-catch","validationCode":"// Ensure the tunnel/forwarding resource is running before resolving\nif (deviceResource.State is not RunningState)\n    throw new InvalidOperationException(\"Device tunnel resource is not running; endpoint cannot resolve.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var endpoint = await tunnelEndpoint.GetValueAsync(timeoutCts.Token);\n}\ncatch (DistributedApplicationException ex) when (ex.Message.Contains(\"MAUI OTLP endpoint could not be determined\"))\n{\n    logger.LogWarning(ex, \"MAUI OTLP endpoint not available within timeout\");\n}","preventionTips":["Verify the device/emulator is connected and online before launching the AppHost","Increase resolution timeout for cold emulator boots","Check tunnel/ADB forwarding logs when resolution repeatedly times out","Confirm the endpoint-publishing resource actually started"],"tags":["otlp","timeout","tunnel","maui"],"backgroundTag":"request-timeout","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}