title: Why does AppDomain.CurrentDomain.GetAssemblies() not return dependant assemblies in Global.asax under certain conditions?
body: <p><strong>EDIT</strong>: This was previously entitled "App Init behaviour different between IIS Restart and Application Initialisation". I have changed the title to expand the question out from IIS/Application Initialisation because the  observed behaviour relates to <code>AppDomain.CurrentDomain.GetAssemblies();</code>  </p>
  
  <p>I am using the IIS Application Initialisation module to warm-up an asmx wed service.</p>
  
  <p>I have implemented some warm-up code to ensure app application initialisation successfully JIT's my asmx service in Global.asax Application_Start event. This uses System.Runtime.CompilerServices.RuntimeHelpers.PrepareMethod() to iterate through all of the assemblies in the application (it also picks up all of the assembly dependencies) to ensure that the first call to the service is as fast as possible.</p>
  
  <p>When I obeserve this behaviour utilising "net stop w3svc &amp; net start w3svc" I can see (via logging) that ALL of the assemblies are JIT'ted and the first call to the service is fast as expected.</p>
  
  <p>However, when the application pool is automatically recycled on its configured time schedule (03:00:00) the log shows only the directly referenced assemblies are JIT'ted, not the dependencies that also sit in the folder.</p>
  
  <p>This is resulting in an unacceptable overhead on the first call to the service.</p>
  
  <p>The App Init performs exactly as expected in all other respects but why does the IIS re-cycle of the Application Pool only JIT compile the directly referenced assemblies and not its dependencies?</p>