Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the PDB file for mscorlib.ni.lib (.Net Framework 3.5)

After doing a lot of search, I still couldn't get the solution for the question.

I have a mdmp file. The call stack shows it is using mscorlib.ni.dll. So to get the function information, I need to get its pdb file.

The version of mscorlib.ni.dll is 2.0.50727.3655. I believe it comes from .Net Framework 3.5.

Since mscorlib.ni.dll is the native optimized dll which is generated by ngen.exe, so I need to use ngen.exe createpdb to generate pdf for this dll.

ngen.exe createpdb "C:\Windows\assembly\...\mscorlib.ni.dll" "C:\SymbolCache"

Here is the result:

  1. I can't find ngen.exe in folder "C:\Windows\Microsoft.NET\Framework64\v3.5"
  2. I could find ngen.exe in folder "C:\Windows\Microsoft.NET\Framework64\v2", but it does not have createpdb option.
  3. I could find ngen.exe in folder "C:\Windows\Microsoft.NET\Framework64\v4.0.30319" and it does support createpdb option, but it reports error.

Microsoft (R) CLR Native Image Generator - Version 4.0.30319.18408 Copyright (c) Microsoft Corporation. All rights reserved. Invalid header found in native image 'C:\Windows\assembly\NativeImages_v2.0.507 7_64\mscorlib\5cd1c2848ff40eb0a8c149706ee394fa\mscorlib.ni.dll'. Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

So I have no idea how to get the pdb for this mscorlib.ni.dll of Net Framework 3.5.

Any idea?

like image 335
Buzz Avatar asked May 21 '14 06:05

Buzz


1 Answers

I had the same error message until I realized I call ngen.exe from the Framework64 folder. Apparently, the mscorlib.ni.dll was not 64-bit.

So I used the 32-bit version of ngen.exe from the folder C:\Windows\Microsoft.NET\Framework\v4.0.30319 and it successfully produced the PDB.

However, the path to your mscorlib.ni.dll includes ...\NativeImages_v2.0.507 7_64\..., which indicates it is 64-bit, so this might be a different issue.

like image 130
Monsignor Avatar answered Nov 12 '22 10:11

Monsignor