-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Implement System.ComponentModel.VersionConverter #28516
Conversation
9ed264a
to
b0e1fb4
Compare
9d7ebd0
to
834a055
Compare
@0xced thanks for your PR. You are adding new public API, which needs to go through API review first. |
834a055
to
ddeef7f
Compare
I just rebased on master and I see that some tests are still failing.
I’m a bit lost here, I’m not sure what I should do to fix these issues. |
For the other issues I would do git clean -fdx then try again. To be clear though this API needs approval from the API review board. They might not convene for a couple weeks, and might reject it or want changes... |
@0xced the API was approved, can you make any necessary changes to match the approved shape, and get tests green? @dotnet-bot test this please |
c49a644
to
2005213
Compare
2005213
to
f93bc30
Compare
I keep rebasing on master but Does anybody has an idea what’s happening with those three platforms? |
f93bc30
to
2ea4691
Compare
The new type you've added only exists in .NET Core; it doesn't exist in .NET Framework or UWP. So the tests when built for .NET Framework or UWP are failing to compile. You need to ensure that your new tests are only built when targeting .NET Core, e.g. with a condition in the project file like |
I just rebased on master and 🎉 all the tests are finally green. ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @0xced
@safern why did you mark it as NO MERGE? |
I added NO MERGE because I'm waiting for response on my comment above: #28516 (comment) |
I'm currently away from computer, I will reply in a few weeks.
…
|
@0xced sure no problem. I'll let this PR sit then. |
@0xced any update? If you can't work on it now, let's close it and reopen when you have time again. Thanks! |
VersionConverter is a new System.ComponentModel.TypeConverter subclass that handle conversions between string and System.Version.
ffc8014
to
004ef11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks @0xced |
Do you know when it will land in .NET Core? I just checked in the recently released version 2.2 and |
@0xced it is in 3.0 milestone. Try 3.0 Preview1 - it went out today as well. |
Excellent! I didn't see it was in a milestone, thanks. |
Couple of things that I would like to point out that are inconsistent between
|
@@ -126,6 +126,7 @@ internal ReflectTypeDescriptionProvider() | |||
[typeof(TimeSpan)] = typeof(TimeSpanConverter), | |||
[typeof(Guid)] = typeof(GuidConverter), | |||
[typeof(Uri)] = typeof(UriTypeConverter), | |||
[typeof(Version)] = typeof(VersionConverter), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure would be nice if every type listed here had a comment on the class itself or in docs someplace that stated it had a type converter. The first place I looked when serialization broke for me on the upgrade to 3.1 from 2.2 was on the Version class and I didn't see it. I searched for usages on GitHub and it's parser must have problems with [typeof(Version)]
as I searched for typeof(Version)
and typeof(System.Version)
with no luck. JamesNK/Newtonsoft.Json#2243
* Implement System.ComponentModel.VersionConverter VersionConverter is a new System.ComponentModel.TypeConverter subclass that handle conversions between string and System.Version. * Fix tests build for VersionTypeConverter * Use Version.Parse() instead of new Version() to save an allocation * Add test data to ensure that the version string is trimmed * Call base class implementation instead of explicitly throwing * Always throw a FormatException when a version string is invalid Commit migrated from dotnet/corefx@a5c7e72
VersionConverter is a new System.ComponentModel.TypeConverter subclass that handle conversions between string and System.Version.
Edit @stephentoub 6/12/2018: https://github.com/dotnet/corefx/issues/28594