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
{{ message }}
Repository navigation
Some MethodInfo(s) of array types loaded by MetadataLoadContext are incorrectly evaluated as equal. #57728
In the above method, Get, Set, and Address can have same uniquifier between calls.
I think uniquifier should be consistent for a MetadataLoadContext instance.
Thanks for the report @shin1m. Do you know if this is a regression from 5.0? cc @steveharter
Sorry, I don't know if or not because 5.0.1 is the first version to me.
According to this view, the code comes from dotnet/corefx#33201 written 3 years ago.
Regards,
ghost added
needs-further-triageIssue has been initially triaged, but needs deeper consideration or reconsideration
@shin1m it doesn't look like they are evaluated as equal, looks it is caused by the Assert.NotEqual()'s logic, I believe if you use Assert.Equal() instead I would fail too
@buyaa-n the error message of Assert.NotEqual() is confusing.
The test case says that Get and Set should NOT be EQUAL, but it fails.
The other assertions fail as well:
var get = type.GetMethod("Get");
var set = type.GetMethod("Set");
// get and set should not be equal.
// all assertions below fail for array types loaded by MetadataLoadContext.
Asssert.False(get.Equals(set));
Asssert.True(get != set);
Asssert.False(get == set);
An easy way would be to assign constant uniquifiers to Get/Set/Address.
If that is the case then the uniquifier is redundant, doesn't seem we need that at all
Although currently uniquifier is not needed due to adding the ReturnType in the last PR (which by coincidence is unique across the 3 methods), keeping the uniquifier, but making it hard-coded instead (e.g. 0=Get; 1=Set; 2=Address) would still be good to make the code more clear and consistent with the other areas that use uniquifier. Currently since it is incremental it is broken.
Also, if we change to hard-coded uniquifier, do we still need ReturnType? (I haven't looked at the code again).
Activity
joperezr commentedon Aug 19, 2021
Thanks for the report @shin1m. Do you know if this is a regression from 5.0? cc @steveharter
shin1m commentedon Aug 19, 2021
@joperezr cc @steveharter
Sorry, I don't know if or not because 5.0.1 is the first version to me.
According to this view, the code comes from dotnet/corefx#33201 written 3 years ago.
Regards,
buyaa-n commentedon Oct 19, 2021
@shin1m it doesn't look like they are evaluated as equal, looks it is caused by the
Assert.NotEqual()'s logic, I believe if you useAssert.Equal()instead I would fail tooshin1m commentedon Oct 19, 2021
@buyaa-n the error message of
Assert.NotEqual()is confusing.The test case says that Get and Set should NOT be EQUAL, but it fails.
The other assertions fail as well:
17 remaining items
joperezr commentedon Nov 3, 2021
cc: @steveharter PTAL regarding the need of
uniquifiersteveharter commentedon Nov 3, 2021
Although currently
uniquifieris not needed due to adding theReturnTypein the last PR (which by coincidence is unique across the 3 methods), keeping theuniquifier, but making it hard-coded instead (e.g. 0=Get; 1=Set; 2=Address) would still be good to make the code more clear and consistent with the other areas that useuniquifier. Currently since it is incremental it is broken.Also, if we change to hard-coded
uniquifier, do we still needReturnType? (I haven't looked at the code again).buyaa-n commentedon Nov 3, 2021
That is even better as do not need the ReturnType check anymore