AppDomain recycle different from real restart

In iis6 there is this feature to recycle your appdomain at certain tresholds, great.

But I recently ran into strange problems when my appdomain was recycled. When my application starts, it loops through all the assemblies it gets from System.AppDomain.CurrentDomain.GetAssemblies(). This works great when the application starts for the first time, I really do get all assemblies that are in my bin-folder. However, when my worker-process gets killed, the next application start will NOT return all the assemblies in the bin folder. It will only return the assemblies that are used up untill that moment. However, changing the bin folder, somehow triggers a different recycle: this one DOES load all assemblies from my bin folder.

Conclusion: there are 2 types of recycles

  • one that does load all assemblies from ‘bin’ into the appdomain as the application starts. And
  • one that only loads the assemblies from ‘bin’ into the appdomain as soon as they’re needed.

I didn’t exactly figure out what causes this, and why it is done so. Only thing I could think of (and did) is to check if only my basic assemblies where returned by System.AppDomain.CurrentDomain.GetAssemblies(). If so, I loop through the bin folder’s files and load them all into the appdomain manually. This works and I do have all assemblies again on application-start, but it still is weird imo.

Update: Hmm, more things seem to have changed regarding recycling