microsoft/aspire · error · ExecutableLaunchConfigurationException

Failed to produce launch configuration type

Error message

Failed to produce launch configuration type '{debugSupport.LaunchConfigurationType}' for resource '{context.Resource.Name}'.

What it means

ProduceLaunchConfigurationAsync wraps any exception thrown while producing a debug launch configuration into an ExecutableLaunchConfigurationException with a message naming the launch configuration type and resource, preserving the inner exception. This indicates the callback/handler that produces launch settings failed.

Solutions

  1. Inspect the inner exception (this message wraps it) to find the actual failure
  2. Verify the launch profile name exists in the resource's launchSettings.json
  3. Ensure launch settings file paths and working directories are correct and the file parses
  4. Check that any custom launch configuration callback completes without throwing

Example fix

// before
proj.WithDebugSupport(launchProfile: "https-missing", configType: KnownLaunchConfigurationTypes.DotnetProject);
// after
proj.WithDebugSupport(launchProfile: "https", configType: KnownLaunchConfigurationTypes.DotnetProject);
Defensive patterns

Strategy: try-catch

Validate before calling

var launchSettingsPath = Path.Combine(projectDirectory, "Properties", "launchSettings.json");
if (!File.Exists(launchSettingsPath)) throw new FileNotFoundException("launchSettings.json not found", launchSettingsPath);

Type guard

bool CanProduceLaunchConfiguration(DebugSupportAnnotation? ds) => ds is null || (File.Exists(ds.LaunchProfilePath) is not false);

Try / catch

try { ... } catch (ExecutableLaunchConfigurationException ex) when (ex.InnerException is not null) { Log(ex.InnerException, "Launch configuration production failed"); }

Prevention

When it happens

Trigger: The launch-configuration-producing delegate throws — e.g., reading a launchSettings.json profile that does not exist, an invalid profile name, or any user callback exception during WithDebugSupport processing — while not being cancellation.

Common situations: Typo in launch profile name; missing or malformed launchSettings.json; custom launch configuration callbacks that throw; wrong working directory for launch settings discovery.

Related errors


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

Appendix: source

Thrown at src/Aspire.Hosting/ApplicationModel/ExecutableLaunchRecipe.cs:415

                context.Resource,
                context.ExecutionConfiguration.EnvironmentVariables.ToDictionary(
                    static variable => variable.Key,
                    static variable => variable.Value,
                    StringComparer.Ordinal),
                context.CancellationToken);
            var launchConfiguration = await debugSupport.LaunchConfigurationProducer(callbackContext).ConfigureAwait(false);

            // The producer result is boxed as object. Serialize its runtime type so integration-specific
            // properties are included rather than emitting only the members declared on System.Object.
            return JsonSerializer.SerializeToElement(launchConfiguration, launchConfiguration.GetType());
        }
        catch (OperationCanceledException) when (context.CancellationToken.IsCancellationRequested)
        {
            throw;
        }
        catch (Exception ex)
        {
            throw new ExecutableLaunchConfigurationException(
                $"Failed to produce launch configuration type '{debugSupport.LaunchConfigurationType}' for resource '{context.Resource.Name}'.",
                ex);
        }
    }
}

/// <summary>
/// Creates compatibility launch plans for legacy <see cref="ProjectResource"/> instances.
/// </summary>
internal sealed class ProjectExecutableLaunchRecipe : IExecutableLaunchRecipe
{
    public static ProjectExecutableLaunchRecipe Instance { get; } = new();

    private ProjectExecutableLaunchRecipe()
    {
    }

    public async Task<ExecutableLaunchPlan> CreateLaunchPlanAsync(ExecutableLaunchContext context)

View on GitHub (pinned to 25830f84bd)