Why does System.Net.Http load all assembly names from the global assembly cache?

Viewed 100

I'm trying to figure out why I can load the assembly name System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a and System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from the global assembly cache.

I have .Net 4.7.2 installed, and I am loading the assembly like this:

var assembly = Assembly.Load("System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
Console.WriteLine(assembly.GetName().FullName);// prints "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

From what I've read, there's nothing to indicate that loading an assembly from the global assembly cache ignores the version number when loading an assembly, so can anyone explain why .Net Framework sees these two different assemblies as equivalent?

1 Answers

I have found a partial answer to this question. This behaviour is the result of the .Net Framework Unification Table. This is a construct inside the .Net Framework runtime that has knowledge of a select number of assemblies, System.Net.Http being one of them.

I can't, however, find any documentation on this, or any way of finding out which assemblies are present in this unification table.

Related