{"record":{"id":"367e1314e9337685","repo":"microsoft/aspire","slug":"failed-to-produce-launch-configuration-type-debugsupport","errorCode":null,"errorMessage":"Failed to produce launch configuration type '{debugSupport.LaunchConfigurationType}' for resource '{context.Resource.Name}'.","messagePattern":"Failed to produce launch configuration type '(.+?)' for resource '(.+?)'\\.","errorType":"exception","errorClass":"ExecutableLaunchConfigurationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/ApplicationModel/ExecutableLaunchRecipe.cs","lineNumber":415,"sourceCode":"                context.Resource,\n                context.ExecutionConfiguration.EnvironmentVariables.ToDictionary(\n                    static variable => variable.Key,\n                    static variable => variable.Value,\n                    StringComparer.Ordinal),\n                context.CancellationToken);\n            var launchConfiguration = await debugSupport.LaunchConfigurationProducer(callbackContext).ConfigureAwait(false);\n\n            // The producer result is boxed as object. Serialize its runtime type so integration-specific\n            // properties are included rather than emitting only the members declared on System.Object.\n            return JsonSerializer.SerializeToElement(launchConfiguration, launchConfiguration.GetType());\n        }\n        catch (OperationCanceledException) when (context.CancellationToken.IsCancellationRequested)\n        {\n            throw;\n        }\n        catch (Exception ex)\n        {\n            throw new ExecutableLaunchConfigurationException(\n                $\"Failed to produce launch configuration type '{debugSupport.LaunchConfigurationType}' for resource '{context.Resource.Name}'.\",\n                ex);\n        }\n    }\n}\n\n/// <summary>\n/// Creates compatibility launch plans for legacy <see cref=\"ProjectResource\"/> instances.\n/// </summary>\ninternal sealed class ProjectExecutableLaunchRecipe : IExecutableLaunchRecipe\n{\n    public static ProjectExecutableLaunchRecipe Instance { get; } = new();\n\n    private ProjectExecutableLaunchRecipe()\n    {\n    }\n\n    public async Task<ExecutableLaunchPlan> CreateLaunchPlanAsync(ExecutableLaunchContext context)","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/ApplicationModel/ExecutableLaunchRecipe.cs#L397-L433","documentation":"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.","triggerScenarios":"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.","commonSituations":"Typo in launch profile name; missing or malformed launchSettings.json; custom launch configuration callbacks that throw; wrong working directory for launch settings discovery.","solutions":["Inspect the inner exception (this message wraps it) to find the actual failure","Verify the launch profile name exists in the resource's launchSettings.json","Ensure launch settings file paths and working directories are correct and the file parses","Check that any custom launch configuration callback completes without throwing"],"exampleFix":"// before\nproj.WithDebugSupport(launchProfile: \"https-missing\", configType: KnownLaunchConfigurationTypes.DotnetProject);\n// after\nproj.WithDebugSupport(launchProfile: \"https\", configType: KnownLaunchConfigurationTypes.DotnetProject);","handlingStrategy":"try-catch","validationCode":"var launchSettingsPath = Path.Combine(projectDirectory, \"Properties\", \"launchSettings.json\");\nif (!File.Exists(launchSettingsPath)) throw new FileNotFoundException(\"launchSettings.json not found\", launchSettingsPath);","typeGuard":"bool CanProduceLaunchConfiguration(DebugSupportAnnotation? ds) => ds is null || (File.Exists(ds.LaunchProfilePath) is not false);","tryCatchPattern":"try { ... } catch (ExecutableLaunchConfigurationException ex) when (ex.InnerException is not null) { Log(ex.InnerException, \"Launch configuration production failed\"); }","preventionTips":["Verify the launch profile name exists before WithDebugSupport","Validate launchSettings.json exists and parses","Test custom launch configuration callbacks in isolation","Inspect InnerException — this error always wraps the root cause"],"tags":["aspire","debugging","launch-profiles"],"backgroundTag":"unexpected-response-shape","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}