oakton
oakton copied to clipboard
"describe" command throws exception when configuration values contain "["
Oakton version: 4.6.1
Error can be reproduced by below code and appsettings.json.
C# code:
using Oakton;
var builder = WebApplication.CreateBuilder(args);
builder.Host.ApplyOaktonExtensions();
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
return await app.RunOaktonCommands(args);
appsettings.json
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ProblemConfig": "value with [bracket]"
}
When run dotnet run describe
, it will throw below exception:
ERROR: System.InvalidOperationException: Could not find color or style 'bracket'.
Solution
I've submitted a PR #69 for fixing this issue by applying EscapeMarkup()
.