{"record":{"id":"6ef22067c432df19","repo":"microsoft/aspire","slug":"markdownshowcase-txt-embedded-resource-not-found","errorCode":null,"errorMessage":"MarkdownShowcase.txt embedded resource not found.","messagePattern":"MarkdownShowcase\\.txt embedded resource not found\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Commands/RenderCommand.cs","lineNumber":834,"sourceCode":"        IAnsiConsole ansiConsole,\n        CommonCommandServices services)\n        : PipelineCommandBase(\"test-render\", \"Test rendering\", runner, projectLocator, features, hostEnvironment, projectFactory, configuration, logger, ansiConsole, services)\n    {\n        protected override string OperationCompletedPrefix => \"Publish\";\n        protected override string OperationFailedPrefix => \"Publish failed\";\n        protected override string GetOutputPathDescription() => \"Test output path\";\n        protected override Task<string[]> GetRunArgumentsAsync(string? fullyQualifiedOutputPath, string[] unmatchedTokens, string? targetStep, ParseResult parseResult, CancellationToken cancellationToken) => Task.FromResult(Array.Empty<string>());\n        protected override string GetCanceledMessage() => \"Test canceled\";\n        protected override string GetProgressMessage(ParseResult parseResult) => \"Test progress\";\n    }\n\n    private static string MarkdownShowcase => LoadMarkdownShowcase();\n\n    private static string LoadMarkdownShowcase()\n    {\n        // File uses .txt extension instead of .md to avoid markdown linters\n        using var stream = typeof(RenderCommand).Assembly.GetManifestResourceStream(\"MarkdownShowcase.txt\")\n            ?? throw new InvalidOperationException(\"MarkdownShowcase.txt embedded resource not found.\");\n        using var reader = new StreamReader(stream);\n        return reader.ReadToEnd();\n    }\n\n    private int TestMarkdownRenderInteractive()\n    {\n        InteractionService.DisplayMarkdown(MarkdownShowcase);\n        return CliExitCodes.Success;\n    }\n\n    private int TestMarkdownRenderPlainText()\n    {\n        var plainText = MarkdownToSpectreConverter.ConvertToPlainText(MarkdownShowcase);\n        InteractionService.DisplayRawText(plainText);\n        return CliExitCodes.Success;\n    }\n\n    private int TestMarkdownRenderRenderable()","sourceCodeStart":816,"sourceCodeEnd":852,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Commands/RenderCommand.cs#L816-L852","documentation":"RenderCommand lazily loads MarkdownShowcase.txt as an embedded resource from its own assembly to demo markdown rendering. If the assembly manifest contains no such resource stream, LoadMarkdownShowcase throws this InvalidOperationException — meaning the build did not embed the file.","triggerScenarios":"Running the markdown-render test/preview path when the MarkdownShowcase.txt file is missing from the project or lacks the EmbeddedResource build action, so GetManifestResourceStream returns null.","commonSituations":"A contributor renamed or moved MarkdownShowcase.txt without updating the csproj; the file's Build Action changed from Embedded Resource to Content/Copy; customized builds stripping resources.","solutions":["Ensure MarkdownShowcase.txt exists in the Aspire.Cli project with <EmbeddedResource Include=\"MarkdownShowcase.txt\" /> in the csproj","Rebuild the CLI so the resource is embedded","Verify with the resource name exactly as \"MarkdownShowcase.txt\" (no default namespace prefix mismatch)"],"exampleFix":"// before (csproj)\n<None Include=\"MarkdownShowcase.txt\" />\n// after\n<EmbeddedResource Include=\"MarkdownShowcase.txt\" />","handlingStrategy":"validation","validationCode":"var names = typeof(RenderCommand).Assembly.GetManifestResourceNames();\nif (!names.Contains(\"MarkdownShowcase.txt\"))\n    throw new InvalidOperationException(\"MarkdownShowcase.txt not embedded.\");","typeGuard":null,"tryCatchPattern":"try { var md = RenderCommand.MarkdownShowcase; }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"embedded resource\")) { Console.Error.WriteLine(\"Resource not embedded; check csproj.\"); }","preventionTips":["Keep MarkdownShowcase.txt as EmbeddedResource in the csproj","Add a build/test check that the manifest resource exists","Re-run resource renames through both file and csproj"],"tags":["cli","render","embedded-resource"],"backgroundTag":"file-not-found","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"}