The reason seems to be ASP.Net and the way it loads assemblies from your application directory for the first time and after a recycle. On first start, the assemblies are loaded from your application's bin directory and after a recycle (or even an IIS restart) it loads the assemblies from the Temporary ASP.NET Files directory. And depending on the situation more or less assemblies are loaded.
You can see this for yourself by adding the following lines to your Application_Start
method in your Global.asax
protected void Application_Start()
{
Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
bool glimpseMvc3AssemblyLoaded = loadedAssemblies.Any(a => a.FullName.Contains("Glimpse.Mvc3"));
File.AppendAllText(
"C:\\temp\\output.txt",
string.Format(
"{0}{1} assemblies loaded and Glimpse.Mvc3 is{2} one of them",
Environment.NewLine,
loadedAssemblies.Length,
glimpseMvc3AssemblyLoaded ? string.Empty : " not"));
}
If you run that then you will see the following entries in your output.txt file (although numbers may differ)
On first initial start:
60 assemblies loaded and Glimpse.Mvc3 is one of them
After recycles
30 assemblies loaded and Glimpse.Mvc3 is not one of them
30 assemblies loaded and Glimpse.Mvc3 is not one of them
After removing the corresponding directory inside the Temporary ASP.NET Files directory
70 assemblies loaded and Glimpse.Mvc3 is one of them
How does this correlate with Glimpse. Well Glimpse makes a call to AppDomain.Current.GetAssemblies()
after which it will look for types that implement ITab
, but if the Glimpse.Mvc3
assembly isn't returned then tabs defined inside of it won't be discovered and hence not shown.
Does this solve your issue? I'm afraid not, but I think it is better to continue this discussion on the glimpse issue tracker, as a matter of fact I already found a similar issue over there, but I'm not sure if it is yours.
Update There will be a fix in one of the upcoming releases of Glimpse, but in the meanwhile there is a solution/workaround, as mentioned in one of the comments on the Glimpse issue.
Simply add the following statement to the Global.asax Application_Start
method
BuildManager.GetReferencedAssemblies()