microsoft/aspire · error · InvalidOperationException
MarkdownShowcase.txt embedded resource not found.
Error message
MarkdownShowcase.txt embedded resource not found.
What it means
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.
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)
Example fix
// before (csproj) <None Include="MarkdownShowcase.txt" /> // after <EmbeddedResource Include="MarkdownShowcase.txt" />
Defensive patterns
Strategy: validation
Validate before calling
var names = typeof(RenderCommand).Assembly.GetManifestResourceNames();
if (!names.Contains("MarkdownShowcase.txt"))
throw new InvalidOperationException("MarkdownShowcase.txt not embedded."); Try / catch
try { var md = RenderCommand.MarkdownShowcase; }
catch (InvalidOperationException ex) when (ex.Message.Contains("embedded resource")) { Console.Error.WriteLine("Resource not embedded; check csproj."); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Embedded telemetry hook script
- Unknown publish summary scenario
- Already connected to AppHost backchannel.
- Already connected to
- AppHost is incompatible with the CLI. The AppHost must be…
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/6ef22067c432df19.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Cli/Commands/RenderCommand.cs:834
IAnsiConsole ansiConsole,
CommonCommandServices services)
: PipelineCommandBase("test-render", "Test rendering", runner, projectLocator, features, hostEnvironment, projectFactory, configuration, logger, ansiConsole, services)
{
protected override string OperationCompletedPrefix => "Publish";
protected override string OperationFailedPrefix => "Publish failed";
protected override string GetOutputPathDescription() => "Test output path";
protected override Task<string[]> GetRunArgumentsAsync(string? fullyQualifiedOutputPath, string[] unmatchedTokens, string? targetStep, ParseResult parseResult, CancellationToken cancellationToken) => Task.FromResult(Array.Empty<string>());
protected override string GetCanceledMessage() => "Test canceled";
protected override string GetProgressMessage(ParseResult parseResult) => "Test progress";
}
private static string MarkdownShowcase => LoadMarkdownShowcase();
private static string LoadMarkdownShowcase()
{
// File uses .txt extension instead of .md to avoid markdown linters
using var stream = typeof(RenderCommand).Assembly.GetManifestResourceStream("MarkdownShowcase.txt")
?? throw new InvalidOperationException("MarkdownShowcase.txt embedded resource not found.");
using var reader = new StreamReader(stream);
return reader.ReadToEnd();
}
private int TestMarkdownRenderInteractive()
{
InteractionService.DisplayMarkdown(MarkdownShowcase);
return CliExitCodes.Success;
}
private int TestMarkdownRenderPlainText()
{
var plainText = MarkdownToSpectreConverter.ConvertToPlainText(MarkdownShowcase);
InteractionService.DisplayRawText(plainText);
return CliExitCodes.Success;
}
private int TestMarkdownRenderRenderable()View on GitHub (pinned to 25830f84bd)