AssemblyName differs for the same assembly when found two different ways?

Copper Contributor

I've been analyzing assembly versions in a .NET 4.7.2 app to resolve assembly binding redirect issues. At this point I've gone through literally hundreds of assemblies but I just came across one that is very troubling. The assembly System.ValueTuple.dll is returning a different AssemblyName (specifically the Version differs) depending on how I get the AssemblyName. For all the other hundreds of assemblies the two methods that follow return the AssemblyName objects which are identical. For System.ValueTuple.dll the first returns a Version of 4.0.0.0 and the second returns a value of 4.0.3.0.

 

 

// Method 1
var assemblyName1 = Assembly.LoadFile({filePath}).GetName();

// Method 2
var assemblyName2 = AssemblyName.GetAssemblyName({filePath});

 

 

Both assemblyName1 and assemblyName2 are of the same Type, both have the same Name and same public key but their versions differ. This is only time I have ever seen this before.

 

Anyone have an idea as to what is happening here?

1 Reply

Hi @Dane Vinson,

Thanks for posting your issue here.

However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
Best Regards,
Lan Huang