What is the story with these files ending with ni?

If you have done much debugging with .NET 2.0, you have probably come across these files before.  For example, instead of seeing mscorlib.dll in your process, you will see mscorlib_ni.dll.  So what are these files?

.ni images are precompiled managed code files. You take an IL image and run it through a tool called ngen.exe, which produces the .ni image. They're generated on a client machine and kept in a cache to avoid having to JIT code on the fly.

.ni images do not have symbol files of their own. Instead, they have the debug record info copied from the original IL image and share the IL image's symbols. There won't be a PDB specifically for a .ni image, nor will there be much of interest in the PDB (unless it's a managed C++ image with both native and managed code).

For some additional information on Ngen code and how to debug it, take a look at Mike Stall's post.  There was also a great article in the MSDN Magazine done by Reid Wilkes back in April of 2005 that you can read here.

kick it on DotNetKicks.com

Published 19 May 08 03:59 by Tom
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# DotNetKicks.com said on May 19, 2008 4:00 PM:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# Adam said on May 19, 2008 7:32 PM:

http://www.youtube.com/watch?v=2UbtcmjfKa8

# Vikram said on May 20, 2008 4:57 AM:

Thanks for sharing the interesting stuff.....

# Chirag said on May 20, 2008 4:52 PM:

May I ask why someone would need the ni files?

# Tom said on May 20, 2008 5:44 PM:

Chirag,

They allow you to not have to compile the files.  They are already native to the machine.  So it loads faster.

# Mojtaba said on May 21, 2008 1:03 AM:

thanks.but i wonder what ni stands for!

ngen ???

# Tom said on May 21, 2008 9:30 AM:

Mojtaba,

ni stands for Native Image.  Because the file is now compiled for that particular platform.

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

Search

This Blog

Syndication

Page view tracker