I am trying to get the all the process modules from the Current process using "ProcessModuleCollection" Class. Please see the code i have used to do the above job. Before that I added a .net 2.0 my own dll to the project as reference. I am able to see that dll in process modules list from the below Code.
So the problem is, when i added a .net 4.0 dll to the project of of same 4.0 version with the same code, i am not able to see the 4.0 dll in the Modules list...I used the same code as below, only project and the dll versions used are 4.0.
I dont know, why it is not working. Please help me to resolve this issue. Thanks in Advance..
Process currentProcess = Process.GetCurrentProcess();
Process ObjModulesList = Process.GetProcessesByName(currentProcess.ProcessName);
// Populate the module collection.
ProcessModuleCollection ObjModules = ObjModulesList.Modules;