Questions tagged [ngen]

The Native Image Generator (Ngen.exe) is a tool for the .NET framework that improves the performance of managed applications by creating and caching processor-specific machine code, so that just-in-time compilation is no longer necessary.

From Native Image Generator (Ngen.exe) on MSDN:

The Native Image Generator (Ngen.exe) is a tool that improves the performance of managed applications. Ngen.exe creates native images, which are files containing compiled processor-specific machine code, and installs them into the native image cache on the local computer. The runtime can use native images from the cache instead using the just-in-time (JIT) compiler to compile the original assembly.

160 questions
1
vote
2 answers

.NET - NGEN compile x86 assembly

This is a followup to this question: NGEN x86 vs x64 with .NET executables I know that it's possible to NGEN using a custom setup action, but I use Inno Setup, so I have to do it manually. The question: if my assembly is compiled in x86 mode, should…
SharpAffair
  • 5,558
  • 13
  • 78
  • 158
1
vote
2 answers

IntelliTrace doesn't work properly once "ngen install ... /profile" is used

We're developing an application that greatly benefits from Profiled Native Images of .NET framework. Due to that, during our installation, we're running the following on several .NET assemblies: ngen install "ASSEMBLY NAME" /Profile Shortly after…
VitalyB
  • 12,397
  • 9
  • 72
  • 94
1
vote
1 answer

NGen error failed to load runtime error

I came across a strange error when using NGen from .NET Framework 4 to compile a bunch of DLL assemblies. The install worked for some of the DLLs, but for some others it produced the following error message: Failed to load the runtime. (Exception…
shiufai
  • 13
  • 1
  • 4
1
vote
0 answers

Is it possible to use the .NET DLR with NGEN for better performance?

It's mainly about .NET 5+, but answering for it's predecessors is also helpful. I was thinking, The DLR running on top of the CLR is maybe inefficient compared to using ngen. Can it use or be made to use .NET's ngen directly? This would improve the…
Ciel Ruby
  • 161
  • 1
  • 13
1
vote
1 answer

Run ngen.exe after Inno install finishes but, before user can launch the app

I am able to run the following in the cmd console and it works. I can see the difference when the app is loading and when executing task within. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install "C:\Program Files (x86)\App…
Jo Srm
  • 21
  • 3
1
vote
1 answer

Inspect / disassemble .Net native images

Is it possible to disassemble / inspect the native code produced by the .Net JITer / ngen? (for purely academic purposes) In attempting to answer this question I became intrigued about what sort of optimisations the JITer would perform - rather than…
Justin
  • 84,773
  • 49
  • 224
  • 367
1
vote
1 answer

Calling ngen.exe in a script by Packer to create an AWS AMI

I have this script that I need to call inside my AWS AMI creation by packer: $path = Get-ChildItem C:\WINDOWS\Microsoft.NET\Framework -Filter ngen.exe -Recurse | % { $_.FullName } Invoke-Expression -Command $path[0] executequeueditems What I do…
Souad
  • 4,856
  • 15
  • 80
  • 140
1
vote
1 answer

How to run ngen from WiX with elevated rights?

I am trying to include ngen to my installer using this article. I want to run ngen synchronously (with priority=0) during installation, but it requires administrative rights to run. So, now I have following message in the log: MSI (s) (74:2C)…
Victor Haydin
  • 3,518
  • 2
  • 26
  • 41
1
vote
0 answers

What is the difference between the NGEN and NGEN Critical scheduled tasks?

I have a situation where a client is needing to manually run the .NET Framework NGEN v4.0.30319 Critical scheduled task to prevent a System.StackOverflowException from occurring in PresentationFramework.dll. The application in question is a 32-bit…
marvhen
  • 314
  • 1
  • 3
  • 13
1
vote
2 answers

How can we improve the early responsiveness of applications deployed to a service fabric cluster

We have a system split into multiple services that are deployed as part of a continuous delivery pipeline into a service fabric cluster. We do experience an impact once deployments are complete, in that the system feels noticeably slower until…
1
vote
1 answer

Why IIS doesn't load ngen assemblies in w3wp process on Windows Server 2012

I've found the problem that IIS didn't load ngen assemblies (.ni - native images) on Windows server 2012. So it loads them from GAC and JIT them in every process. I know that native images can be shared across processes, so there is no cost for JIT…
StuS
  • 817
  • 9
  • 14
1
vote
1 answer

Why do plain, non-profile-optimized native images aren't loaded by my CLR profiler?

I'm developing a CLR profiler, using the CLR profiling interfaces, and having a hard time getting the CLR to load plain, non-profile-optimized native images (that were compiled with ngen.exe without the /profile option) when running my profiler (or…
valiano
  • 16,433
  • 7
  • 64
  • 79
1
vote
0 answers

Native Image of Microsoft.mshtml referencing IL assembly cannot be loaded

Problem I have a WPF Application that is referencing Microsoft.mshtml Primary Interop Assembly. I'm creating a native image of my app using NGen. I'm afraid the native image is never being loaded if I start my app. Reproduction Info E.g. create new…
tstadel
  • 31
  • 5
1
vote
3 answers

How do I prevent NGEN from rebasing my code (negatively affecting performance)?

I simply want to speed up my .NET-base client side app and am considering NGEN-ing the code. Jeffery Richter wrote this warning about ngening code: •Inferior Load-Time Performance (Rebasing). When Windows loads an NGend file, it checks to see…
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
1
vote
1 answer

NGEN Display Returns A different result than Elevated CMD when run using Process.Start() in C# winforms

i have been trying to figure this out with my co-workers for a while now. i use Ngen to Make Native images and boost my Applications performance on the clients. lets assume the Exe Filename is Example.exe what i try to do in the app is that i do…
Niklas
  • 955
  • 15
  • 29