Skip to content

Fix VersionConverter for versions without Build/Revision - #136423

Merged
jkotas merged 1 commit into
dotnet:mainfrom
am11:fix/58331-versionconverter
Oct 24, 2026
Merged

jkotas merged 1 commit into
dotnet:mainfrom
am11:fix/58331-versionconverter

Conversation

@am11

@am11 am11 commented Oct 24, 2026

Copy link
Copy Markdown
Member

Fixes #58331

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Oct 24, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-componentmodel
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused fix handles each version shape correctly, with regression coverage for every modified conversion path and no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes VersionConverter conversions for versions with unspecified build or revision components, addressing #58331 without changing the public API.

Changes:

  • Uses Version.Clone() to preserve unspecified components when copying versions.
  • Selects the matching two-, three-, or four-argument constructor for InstanceDescriptor.
  • Adds regression tests for version copies and descriptor round trips across all three version shapes.

Builds and tests were not run during this review.

File Description
src/​libraries/​System.ComponentModel.TypeConverter/​tests/​VersionConverterTests.cs Adds copy and round-trip regression coverage.
src/​libraries/​System.ComponentModel.TypeConverter/​src/​System/​ComponentModel/​VersionConverter.cs Preserves unspecified components in copies and descriptors.

Review effort: Balanced

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

@jkotas
jkotas enabled auto-merge (squash) October 24, 2026 14:37
@jkotas

jkotas commented Oct 24, 2026

Copy link
Copy Markdown
Member

/ba-g failure is known issue #133328

@jkotas
jkotas merged commit f0c7a08 into dotnet:main Oct 24, 2026
96 of 98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.ComponentModel community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VersionConverter.ConvertTo/From may fail with Version and InstanceDescriptor types

3 participants