I have a little confusion. According to MSDN the location of global assembly cache is C:\Windows\Microsoft.NET\assembly from .NET 4.0 on-wards and for older version it is C:\Windows\assembly. Now I wrote a hello world program in .NET 4.6.1 and according to VS 2017 modules window, the assembly is loaded from the first location which looks wrong to me. And according to process explorer, the assembly is loaded from the second location and that is actually correct because I tested it using the HANDLE command that is in Process Explorer. Please see the screenshots. So why is VS showing the wrong location? Is that a VS bug?
Asked
Active
Viewed 456 times
-1

Varun Sharma
- 2,591
- 8
- 45
- 63
-
1Everything is correct. mscorlib.dll is not the same file as mscorlib.ni.dll. The latter is the prejitted native image, they are still stored in c:\windows\assembly. – Hans Passant Apr 09 '18 at 09:22
-
@Hans - thanks but the file mscorlib.dll is not loaded into the process. Process Explorer is not showing mscorlib.dll. However mscorlib.ni.dll is loaded. So Modules window is showing the wrong file? Is that correct? – Varun Sharma Apr 09 '18 at 09:28
-
@Hans - by the way I am still able to open mscorlib.ni.dll using a decompiler and it shows C# code. – Varun Sharma Apr 09 '18 at 09:30
-
1@VVV, You could find much more information about this dll file here:https://blogs.msdn.microsoft.com/junfeng/2004/11/11/mscorlib-ni-dll/ and this one: https://developercommunity.visualstudio.com/content/problem/90494/visual-studio-fails-to-load-symbols-for-mscorlibni.html, so you could try to change the debugging option, view the modules window again. – Jack Zhai Apr 11 '18 at 09:46
-
@JackZhai-MSFT - thanks I was able to see mscorlin.ni.dll in the modules window but had to attach to native process to see that. – Varun Sharma Apr 13 '18 at 23:46
-
@VVV, Thanks for your friendly response, so your previous issue has been resolved, am I right? I mean about the issue "why it loaded mscorlin.ni.dll in the modules window instead of the mscorlib.dll". If it has been resolved, maybe I post my previous comment as the answer, so we could close this case. For your new issue, one possible reason is that it would be related to the app itself, for example, how did this app run? Maybe it depends on another process in default or others. – Jack Zhai Apr 16 '18 at 08:19
-
@JackZhai-MSFT - yes sure you can post it as an answer to this question. – Varun Sharma Apr 17 '18 at 07:03
-
@VVV, Thanks for your response again, I just add it as the answer. Have a nice day:) – Jack Zhai Apr 17 '18 at 09:31
1 Answers
0
The Mscorlib.ni.dll is the native image of mscorlib.dll. You could get detailed information here about why VS debug load this symbols instead of the mscorlib.dll.
https://blogs.msdn.microsoft.com/junfeng/2004/11/11/mscorlib-ni-dll/
But if it failed to load this dll file in Debug module windows, you could view this report here:

Jack Zhai
- 6,230
- 1
- 12
- 20