If you have ever installed the .NET Framework 1.0 or 1.1 package by running dotnetfx.exe directly (as opposed to installing it silently via Windows Update or via an application that redistributes it), I'm sure you've seen strange behavior where it appears to hang for several minutes right before setup completes. Normally when this happens the progress bar is full or very nearly full and the time remaining says "0 seconds" (or possibly it hits one of my favorite Windows Installer bugs and says "1 seconds").
During this time, setup is not actually hung. The .NET Framework setup is running several custom actions to launch ngen.exe to generate native images (also called pre-jitting) for several .NET Framework assemblies. Depending on the speed of the machine that setup is running on, this process can take several minutes.
Unfortunately we also shipped with a couple of problems in the .NET Framework setup package that prevented us from updating progress while this was going on:
- We neglected to author action text for some of these custom actions in the ActionText table of the MSI. The action text is what Windows Installer uses to show messages above the progress bar during setup, and if there is not action text for a particular action it does not update the message for that action, which can create the impression that setup is hung.
- We did not include any ability to provide live progress bar updates while running these ngen.exe custom actions. These custom actions call an executable that is installed as a part of the .NET Framework. In order to update the progress bar, a custom action has to interact directly with Windows Installer in the code, and ngen.exe does not do that. If you are interested in reading more about how to interact with the main MSI progress bar from within a custom action, there is a really good doc on MSDN with step-by-step instructions and some sample code. Check it out by clicking here.
So the bad news is that setup sometimes looks hung towards the end for the .NET Framework 1.0 and 1.1. The good news is that there was some custom action work done specifically around how we do native image generation in the .NET Framework 2.0 and partially as a result of this, progress UI now looks and behaves interactively for the entire length of setup and doesn't appear hung at the end anymore.
Ironically, when we install the .NET Framework as part of Visual Studio setup, we are able to give a more realistic sense of progress because of the "fake progress" strategy we implemented there.