You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
In VS2022 I have opened the main code project and got the tests running. All looked good until I tried Dictionary<int, SortedList>
this deserialized the integer keys, but all reference values were null.
A Dictionary where the key is string seems to work fine, but most other type fail due to the generic comparers not implementing IConvertible
for my production code GenericEqualityComparer<T> is the type in the XML which does not match the expected type IEqualityComparer so in System.Private.CoreLib\src\System\Convert.cs an InvalidCastException is raised, not sure why no exception in the package test code, but it results in the same thing...
if (!(value is IConvertible ic))
{
if (value.GetType() == conversionType)
{
return value;
}
throw new InvalidCastException(SR.InvalidCast_IConvertible);
}
The code look wrong, in the sense that GenericEqualityComparer<T> implements the expected type IEqualityComparer, so should probably just cast it and everything would be fine.
If you know of a good work around, that would be great.
This is probably an issue with .NET code, so maybe listing the limitation is all you can do
Cheers Neil
The text was updated successfully, but these errors were encountered:
Hi,
In VS2022 I have opened the main code project and got the tests running. All looked good until I tried
Dictionary<int, SortedList>
this deserialized the integer keys, but all reference values were null.
A
Dictionary
where the key isstring
seems to work fine, but most other type fail due to the generic comparers not implementingIConvertible
for my production code
GenericEqualityComparer<T>
is the type in the XML which does not match the expected typeIEqualityComparer
so inSystem.Private.CoreLib\src\System\Convert.cs
anInvalidCastException
is raised, not sure why no exception in the package test code, but it results in the same thing...The code look wrong, in the sense that
GenericEqualityComparer<T>
implements the expected typeIEqualityComparer
, so should probably just cast it and everything would be fine.If you know of a good work around, that would be great.
This is probably an issue with .NET code, so maybe listing the limitation is all you can do
Cheers Neil
The text was updated successfully, but these errors were encountered: