question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.InvalidOperationException: 'Could not find color or style '0'.

See original GitHub issue

image

Caused by this

 AnsiConsoleExtensions.Log($"Data[0]: {_data[0]}", "info");

basically

AnsiConsole.MarkupLine($"[white]{timeStampFull}-{severity.ToUpper()}:[/] {message} [white]...[/]");

doesn’t like the extra braces but why should that matter?

the number of opening markup tokens should matchup the number of closing tokens, if there are more then these are likely part of the message even more so if they contain no valid markup tag

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
patriksvenssoncommented, Mar 23, 2021

You’ll have to escape it with either mystring.EscapeMarkup() or Markup.Escape(myString).

See the section “Escaping format characters” at https://spectresystems.github.io/spectre.console/markup for more information.

1reaction
gitfoolcommented, May 21, 2021

It just occurred to me that it’s probably related to the dictionary keys and values I’m using:

Config.ToTokens().ToDictionary(entry => entry.Key, entry => entry.Value.ToValueString()).ToJson();

Yields:

{
  "Commands.Deploy.Repair[0]": "code.cmd",
  "Commands.Deploy.Repair[1]": "--new-window",
  "Commands.Deploy.Repair[2]": "--wait",
  "Environment.Name": "alpha",
  "Environment.DisplayName": "Alpha",
  "Environment.Type": "Development",
  "Environment.CostCenter": "Beacon",
  "Environment.Aws.AssumeRoleArn": "arn:aws:iam::REDACTED:role/deployer",
  "Environment.Aws.AccountId": "REDACTED",
  "Environment.Aws.Region": "us-west-2",
  "Environment.Aws.Ec2.InstanceType": "t3.medium",
  "Environment.Aws.Ec2.KeyName": "beacon-oregon",
  "Environment.Aws.Eks.AutoScaling.DesiredCapacity": "1",
  "Environment.Aws.Eks.AutoScaling.MinSize": "1",
  "Environment.Aws.Eks.AutoScaling.MaxSize": "1",
  "Environment.K8s.Version": "1.20",
  "Pulumi.Organization.Name": "pharos",
  "Pulumi.Organization.DisplayName": "Pharos"
}

And I’ve just confirmed that EscapeMarkup fixes it. 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - InvalidOperationException when trying to animate ...
I'm trying to programmatically trigger a color animation on a button, but getting a System.InvalidOperationException when I do. It seems it can' ......
Read more >
ASP.NET 2.0: Could not find control 'CONTROLNAME' in ...
Exception Details: System.InvalidOperationException: Could not find control 'lstMakes' in ControlParameter 'MakeID'. Source Error:
Read more >
Web service error codes (Microsoft Dataverse) - Power Apps
This topic lists the error codes you might encounter when you debug your code.
Read more >
Dowloading/Uploading SSRS Report Error on ALL ...
anyone seen this error? Someone tried to upload a report and now we cant edit any reports (including the std reports) from report...
Read more >
Unknown TlsProvider `Default (Native TLS 1.2+)` when ...
Attached project fails build on VS2022 Preview for Mac with: System.InvalidOperationException: Unknown TlsProvider `Default (Native TLS 1.2+)`
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found