I received a mention on Twitter saying that the website for my micro framework (http://jessicafx.org) was serving up blank pages, instead of the actual views. This was a problem, initially Jessica would serve up views and after an arbitrary length of time it would just begin serving up blank pages.
I connected to my web server via remote desktop to check the event logs, and found an exception being thrown because it was checking for actions via a key in the correct manner, so I fixed this thinking that this would solve the issue. Rebuilt the project, and everything was fine until the end of the day when I decided to see if the site was still serving the correct pages.
Unfortunately, I had solved a bug, but it wasn't the correct bug! I located the code which would serve up blank pages if an exception was caught, which is located in the view engine related code. So I rebuilt the project, deployed, and waited until the morning to see what exception was being thrown, because I didn't know how exactly to reproduce the issue. It was throwing an exception because it couldn't locate a view engine to render the view.
This was bizarre because it works initially, and only after a while it would stop working correctly. I went round @martirue's to work on some stuff, and we ended up taking a look at the problem, and see if we could debug the issue. Jessica functioned correctly when the website was running on version 0.5.0 and the issue was only present in 0.5.1/0.5.2. So I looked at what features where included between those that was related to view engines.
In 0.5.1 I had introduced the auto registering of view engines that implemented the IViewEngine interface. Martin suggested that it could be when IIS recycles the App Pool that is breaking Jessica. So we stepped through code and decided that it must not be finding the view engine that the web site was using. So we impementing some simple text file logging to output the assemblies which AppDomain.CurrentDomain.GetAssemblies() returned, viewed the log initially, recycled the App Pool, and viewed the log. Between the recycle the App Pool had not loaded the Jessica.ViewEngines.DotLiquid.dll. We searched Google for some answers regarding what is happening. The conclusion was that the App Pool doesn't load assemblies for applications which aren't specifically using a type from the assembly. So this resulted in the view engine assembly not being loaded after the App Pool was recycled.
So the solution was to manually use Assembly.LoadFrom being using AppDomain.CurrentDomain.GetAssemblies() to load Jessica specific DLLs so we can guarantee they are loaded.
AppDomain: 0 - Tom (& Martin): +1