Skip to content

AnsiConsole.Write(string) tries to use input as format string.. #1387

@Ttxman

Description

@Ttxman

Information

  • OS: Windows
  • Version: 0.48.0
  • Terminal: Windows Terminal

Describe the bug
AnsiConsole.Write(string value) is calling AnsiConsole.Write(String format, Object[] args) this have some unexpected and undocumented behaviour:

  • Call throws exceptions when string contains double braces and is not valid format string for string.Format
  • When the string could be valid format string and have single parameter like "test {0}" some internal data (Spectre.Console.Style) is passed to the format.
  • When there is more than one format parameter like "test {0} {1}" it throws another Format exception.

To Reproduce
Just call AnsiConsole.Write("{") or AnsiConsole.Write("test {0}") or AnsiConsole.Write("test {0} {1}")

Expected behavior
String passed as parameter to AnsiConsole.Write is just shown in console..

Screenshots
image
image


Please upvote 👍 this issue if you are interested in it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo 🕑

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions