Skip to content

[code-simplifier] Remove redundant .ToString() in TimingInfo.ToString()#7961

Open
Evangelink wants to merge 2 commits intomainfrom
simplify/timing-tostring-redundant-056b7c1c103ef825
Open

[code-simplifier] Remove redundant .ToString() in TimingInfo.ToString()#7961
Evangelink wants to merge 2 commits intomainfrom
simplify/timing-tostring-redundant-056b7c1c103ef825

Conversation

@Evangelink
Copy link
Copy Markdown
Member

@Evangelink Evangelink commented Apr 30, 2026

  • docs: add Informal Spec (FV) to glossary
  • Remove redundant .ToString() in TimingInfo.Append call

Fixes #7955

github-actions Bot and others added 2 commits April 30, 2026 16:02
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>
Copilot AI review requested due to automatic review settings April 30, 2026 14:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a StringBuilder in TimingInfo.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

Copy link
Copy Markdown
Member Author

@Evangelink Evangelink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🧠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[code-simplifier] Remove redundant .ToString() in TimingInfo.ToString()

2 participants