Description
Description
Some MethodInfo(s) of array types loaded by MetadataLoadContext are incorrectly evaluated as equal.
They are expected not to be equal.
[Fact]
public void MethodsShouldBeDistinguished()
{
using var context = new MetadataLoadContext(new PathAssemblyResolver(Directory.EnumerateFiles(RuntimeEnvironment.GetRuntimeDirectory(), "*.dll").Append(typeof(ArrayTests).Assembly.Location)));
Type project(Type x) => context.LoadFromAssemblyName(x.Assembly.FullName).GetType(x.FullName, true);
17 void test(Type type) => Assert.NotEqual(type.GetMethod("Get"), type.GetMethod("Set"));
test(typeof(int[]));
19 test(project(typeof(int[])));
}
Failed MLCTests.ArrayTests.MethodsShouldBeDistinguished [54 ms]
Error Message:
Assert.NotEqual() Failure
Expected: Not System.Int32 Get(System.Int32)
Actual: System.Void Set(System.Int32, System.Int32)
Stack Trace:
at MLCTests.ArrayTests.<MethodsShouldBeDistinguished>g__test|0_1(Type type) in .../MLCTests/ArrayTests.cs:line 17
at MLCTests.ArrayTests.MethodsShouldBeDistinguished() in .../MLCTests/ArrayTests.cs:line 19
Configuration
- System.Reflection.MetadataLoadContext 5.0.1
$ LANG=C dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.5.21302.13
Commit: d6380bcae7
Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: .../sdk/6.0.100-preview.5.21302.13/
Host (useful for support):
Version: 6.0.0-preview.5.21301.5
Commit: ec3e0b276b
Other information
In the above method, Get, Set, and Address can have same uniquifier
between calls.
I think uniquifier
should be consistent for a MetadataLoadContext instance.