I am using reflection to pick up a collection of Types to register in a container.
Problem is, after IIS 7.5 app pool recycles or an IISRESET, not all the assemblies can be picked up through reflection.
Any way to solve this problem without going through the bin folder and doing assembly load on each DLL?
Update:
I am using AppDomain.Current.GetAssemblies() to retrieve all the assemblies loaded.
Problem solved.
Don’t use AppDomain.CurrentDomain.GetAssemblies().
Instead, use
Only quirk is .GetReferencedAssemblies() passes back ICollection (of objects) which you need to cast to Assembly then work with.
Thanks all for your help.
Edit- Credit goes to Dominic Pettifer – “AppDomain.CurrentDomain.GetAssemblies() Considered Armed and Extremely Dangerous”
http://www.dominicpettifer.co.uk/Blog/44/how-to-get-a-reference-to-all-assemblies-in-the–bin-folder?replyId=357
Indeed.
Tripple Edit. not AppDomain.CurrentDomain.GetReferencedAssemblies(). Use the BuildManager class from System.Web.Mvc.