Bump Spectre.Console dependencies to 0.55.0 and fix breaking changes#46
Bump Spectre.Console dependencies to 0.55.0 and fix breaking changes#46boxofyellow merged 2 commits intomainfrom
Conversation
…nges Agent-Logs-Url: https://github.com/boxofyellow/ConsoleMarkdownRenderer/sessions/9f818f41-5c27-47a4-bf01-9e877934d359 Co-authored-by: boxofyellow <54955040+boxofyellow@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #46 +/- ##
=======================================
Coverage 90.46% 90.46%
=======================================
Files 18 18
Lines 839 839
Branches 86 86
=======================================
Hits 759 759
Misses 59 59
Partials 21 21 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
boxofyellow
left a comment
There was a problem hiding this comment.
@copilot please take a look at this comment.
| else | ||
| { | ||
| Table.BorderStyle(borderStyle); | ||
| Table.BorderStyle(borderStyle!.Value); |
There was a problem hiding this comment.
@copilot why is the ! required here? this is in the else block of the borderStyle == default check.
I don't recall, is/was Style an object or a struct?
This might be more readable
if (borderStyle.HasValue)
{
Table.NoBorder(borderStyle.Value);
}
else
{
Table.NoBorder();
}There was a problem hiding this comment.
You're right — Style was a class in 0.54.0 and is now a struct in 0.55.0. The ! was a workaround: the compiler doesn't recognize borderStyle == default as a null-guard in its flow analysis (unlike borderStyle == null or borderStyle.HasValue), so it still emitted CS8629. Using HasValue/Value makes the intent explicit and avoids needing the null-forgiving operator. Fixed in 6450b17 (note: your example had NoBorder in both branches — I used BorderStyle in the HasValue branch).
Agent-Logs-Url: https://github.com/boxofyellow/ConsoleMarkdownRenderer/sessions/019d86f8-692d-426f-9544-685fe0d5b615 Co-authored-by: boxofyellow <54955040+boxofyellow@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Recreates the dependency bump from PR #45, bumping all three Spectre.Console packages to 0.55.0 and fixing the breaking changes introduced by that release.
Dependency Updates
Spectre.Console: 0.54.0 → 0.55.0Spectre.Console.Cli: 0.53.1 → 0.55.0Spectre.Console.Testing: 0.54.0 → 0.55.0Breaking Change Fixes
Spectre.Console 0.55.0 converts
Stylefrom a class to a struct and introduces a newTableCelltype. The following fixes address the resulting build failures and test failures:TableCellambiguous reference (ConsoleObjectRenderers.cs): Addedusing TableCell = Markdig.Extensions.Tables.TableCell;alias to resolve the ambiguity betweenSpectre.Console.TableCellandMarkdig.Extensions.Tables.TableCell.Nullable
Stylestruct unwrap (ConsoleRendererBase.Frame.cs):BorderStyle()now takesStyle(notStyle?), so usedborderStyle!.Valuein the branch that is guaranteed non-null.Ternary
defaultresolved as struct, not null (ConsoleRendererBase.cs):Style.Plain : defaulthaddefaultinferred asdefault(Style)(a zero-initialized struct) instead ofnull. A non-nullNullable<Style>was always assigned, soNoBorder()was never called — all frames got visible borders regardless ofIncludeDebug. Fixed by using(Style?)null.Ternary
nulltriggeringop_Implicit(string)with null (ConsoleRendererBase.cs): After fix Allow caller to overwrite styling #3, the remaining issue was thatStyle.Plain : nullcaused the compiler to preferstringas the type ofnull(sinceop_Implicit(String)->Styleexists), generating a call toStyle.op_Implicit(null)which throwsNullReferenceException. Fixed by using(Style?)null.Test style comparison (
RendererTests.cs): In 0.55.0, rendered segments now include colors inherited from the rendering context (e.g.#000000 on #000000from the default TestConsole style). UpdatedCheck()to only compare color components that were explicitly set in the expected style, while still strictly comparing decoration.