[code-simplifier] Remove redundant .ToString() in TimingInfo.ToString()#7961
[code-simplifier] Remove redundant .ToString() in TimingInfo.ToString()#7961Evangelink wants to merge 2 commits intomainfrom
.ToString() in TimingInfo.ToString()#7961Conversation
Add definition for the 'Informal Spec' FV concept introduced by recent formal-verification work (commit 485bb51). The term recurs in formal-verification/REPORT.md and specs/ but was not yet defined in the glossary, leaving Phase 2 of the FV target lifecycle unexplained. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
StringBuilder.Append(Duration) is functionally identical to StringBuilder.Append(Duration.ToString()) and consistent with the other Append calls in the same method (StartTime, EndTime). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR simplifies TimingInfo.ToString() output construction by removing a redundant ToString() call, and extends the documentation glossary with a definition related to the repo’s formal verification workflow.
Changes:
- Remove an explicit
Duration.ToString()call when appending to aStringBuilderinTimingInfo.ToString(). - Add a new glossary entry defining “Informal Spec (FV)” and its place in the FV lifecycle.
Show a summary per file
| File | Description |
|---|---|
| src/Platform/Microsoft.Testing.Platform/Messages/TimingProperties.cs | Simplifies TimingInfo.ToString() by appending TimeSpan directly. |
| docs/glossary.md | Adds “Informal Spec (FV)” definition and links it into existing FV glossary terms. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
Evangelink
left a comment
There was a problem hiding this comment.
Summary
Workflow: Expert Code Reviewer
Date: 2026-04-30
Repository: microsoft/testfx
Key Findings
No issues found.
Correctness ✅ — StringBuilder.Append(Duration) resolves to Append(object?), which internally calls Duration.ToString(). The output is byte-for-byte identical to the removed Duration.ToString() call.
Performance ✅ — There is a minor boxing allocation (TimeSpan is a struct passed to Append(object?)), but this occurs inside a ToString() override that already allocates a StringBuilder and multiple strings, making the overhead negligible and not a hot-path concern.
Cross-TFM ✅ — StringBuilder.Append(object?) is available across all supported TFMs (net462, netstandard2.0, net8.0, net9.0).
Docs change ✅ — The glossary addition for "Informal Spec (FV)" is accurate and well-placed.
Recommendations
None — the simplification is correct and the PR is ready to merge.
Generated by Expert Code Reviewer
🧠 Reviewed by Expert Code Reviewer 🧠
Fixes #7955