Skip to content

[Improvement] SemanticVersion.ToString #2879

@chris-codeflow

Description

@chris-codeflow

I noticed in the XML documentation (in the source code) for the SemanticVersion.ToString method (the IFormattable.ToString implementation) that the format pattern for the default SemVer format "s" was incorrect (it included the build metadata). After reviewing the code, I have identified a set of improvements that can be made to the SemanticVersion.ToString implementation.

Detailed Description

  • Correct the SemanticVersion XML comment for the default SemVer ("s") format.
  • Align the IFormattable.ToString method signature with the .NET Standard 2.0 implementation.
  • Throw FormatException exceptions from ToString instead of ArgumentException.
  • Refactor all the ToString tests to use NUnit TestCase attributes.

Context

I needed to understand the difference between the SemVer and FullSemVer output variables, so I checked the source code. When reviewing the code, I identified that the XML documentation for the SemanticVersion.ToString method was incorrect and my review then lead me to identify a number of improvements.

Possible Implementation

See the Detailed Description section above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions