Open Jobria opened 8 years ago
Next step: Root cause with the help of debugger and fix it.
@karelz any progress here?
@carusology there is currently no action planned from our side (milestone is Future, it is not assigned to anyone and it is marked as up-for-grabs). Any particular reason why you're looking for progress? The impact seems to be small. I don't see any specific reason why this bug should be higher priority than the rest of the ~2,000 bugs we have in the repo ...
Thanks for the update, @karelz.
We have a hack in the code with a comment that points to this issue as the root cause. From my perspective it is not critical, just a "nice to have."
To judge from comparing reference source and corefx:
Original NetFX implementation used TypeDescriptor.GetConverter(type).ConvertFromInvariantString(value)
which would work fine with typeof(Guid)
for type
and ""8DAEDD83-289E-417C-AAAC-D48D77E0D84C"
for value
.
Silverlight implementation would see if it could use Enum.Parse
, then see if it could use TimeSpan.Parse
and finally if the type belonged to the same module as string
(which is true for Guid
) attempt Convert.ChangeType()
(which won't work for Guid
).
CoreFX implementation is the Silverlight implementation, but with the same-module-as-string restriction. But since that still won't work, that is moot.
Changing to copy the NetFX approach would seem the most obvious step, but alas TypeDescriptor
lives in corefx while DefaultValueAttribute
lives in the shared coreclr/corert code
I don't see a Reflection issue here - the issue is the implementation of DefaultValueAttribute
I create simple application and can not reproduce the issue. Perhaps the issue came from how type converters was packaged to assemblies. I think the issue can be closed. Although maybe there are more tests needed, but that's another story. /cc @ericstj
I added the DefaultValueAttribute into the a Guid property and get the attribute in constructor of the object but the value in the attribute is null. I have also tried another type of attribute like "int", "long", "flost" or etc. It works great. Anyone have idea what's wrong of the Guid type?
The following is the coding for reference.
The retrieve value in constructor like this