How are dll's loaded by the CLR?
- by priehl
My assumption was always that the CLR loaded all of the dlls it needed on startup of the app domain. However, I've written an example that makes me question this assumption. I start up my application and check to see how many modules are loaded.
Process[] ObjModulesList;
ProcessModuleCollection ObjModulesOrig;
//Get all modules inside the process
ObjModulesList = Process.GetProcessesByName("MyProcessName");
// Populate the module collection.
ObjModulesOrig = ObjModulesList[0].Modules;
Console.WriteLine(ObjModulesOrig.Count.ToString());
I then repeate the exact same code and my count is different. The additional dll is C:\WINNT\system32\version.dll.
I'm really confused as to why the counts would be different.
Could someone please elaborate on what the clr is doing and how it's loading these thing, and by what logic it's doing so?