Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

.NET Framework 2.0 hotfix installation can cause temporary application performance problems

.NET Framework 2.0 hotfix installation can cause temporary application performance problems

  • Comments 5

Some customers who have installed the recent .NET Framework 2.0 security update (KB928365 and MS07-040) on systems that also have the .NET Framework 3.0 installed have noticed performance degradation in their Windows Presentation Foundation (WPF, also formerly known as Avalon) applications for a short period of time after installing this update.

As Heath Stewart previously described in this blog post, installing an update for the .NET Framework 2.0 causes native images to need to be re-generated for assemblies that depend on any updated .NET Framework 2.0 assemblies (including .NET Framework 3.0 assemblies).  The startup performance of some WPF applications depends greatly on having available native images, so if the existing native images are invalid and need to be re-generated, these WPF applications will take longer to load until the WPF native images have been re-generated.

During the initial installation of the .NET Framework 3.0, some of the .NET Framework 3.0 assemblies were flagged as "critical," which will cause native images to be generated at initial setup time.  However, that flag is not currently respected in cases where an update to another product causes native images to need to be regenerated.  In this case, the security update only modifies the .NET Framework 2.0 product, and does not update the .NET Framework 3.0 product.  This causes the 3.0 assemblies to be queued for new native image creation in the background.  The NGEN service waits until the system is idle for 5 minutes before processing the background queue.

Heath posted a workaround that can be used to cause the queued native images to be generated immediately so you do not have to wait for system idle time - you can run this command from a cmd prompt (if you are running Windows Vista, you need to use an elevated administrator cmd prompt):

%windir%\Microsoft.NET\Framework\v2.0.50727\ngen.exe executeQueuedItems

Fortunately, as Heath and Surupa (a program manager on the NGEN team here at Microsoft) point out in this blog post, the NGEN team and the .NET Framework setup team are implementing a fix in the next .NET Framework 2.0 update that will ensure that future updates made to .NET Framework 2.0 assemblies will trigger immediate native image re-generation for all critical .NET Framework assemblies (including those that are a part of the .NET Framework 3.0 and not just 2.0).  One important thing to note is that since this is a fix in the NGEN service, it will be in effect for updates that ship after the next update (because the first update is needed to change the behavior of NGEN itself, and then any future updates to the .NET Framework will be able to take advantage of that behavior change).

Leave a Comment
  • Please add 2 and 1 and type the answer here:
  • Post