I encountered the following bug in a real application:
void WarningLine(string message, params object[] args) => AnsiConsole.MarkupLine($"[yellow]{message}[/]", args);
WarningLine("Are you sure you want to continue? [y/n]");
Exception thrown: 'System.InvalidOperationException' in Spectre.Console.dll: 'Could not find color or style 'y/n'.'
So I think it would be good to have an analyzer to warn against using MarkupLine with interpolated strings, and suggest the following fixes:
-AnsiConsole.MarkupLine($"[yellow]{message}[/]");
+AnsiConsole.MarkupLineInterpolated($"[yellow]{message}[/]");
-AnsiConsole.MarkupLine($"[yellow]{message}[/]", args);
+AnsiConsole.MarkupLineInterpolated($"[yellow]{string.Format(message, args)}[/]")
I encountered the following bug in a real application:
So I think it would be good to have an analyzer to warn against using
MarkupLinewith interpolated strings, and suggest the following fixes: