Buildstarted/Errlusion — Issue #4: TypeInitializationException: Errlusion + Ninject
Author: jameswilson281
Created: 2012-01-25 15:48:44+00:00
State: open

First of all, awesome job with this. I love being able to set up configuration-less error handling.

I'm having an issue trying to use this with Ninject. MvcApplication inherits from NinjectHttpApplication, which hides Application_Start(). Instead, it exposes the virtual OnApplicationStarted method. Unfortunately, when I try to set up Errulsion from there, I'm getting a TypeInitializationException:

"This method can only be called during the application's pre-start initialization stage."

Stack Trace:
at Errlusion.Routing.Handle(HttpStatusCodes statusCode, Expression`1 expression)
at .Web.MvcApplication.OnApplicationStarted() in .Web\Global.asax.cs:line 49
at Ninject.Web.Mvc.NinjectHttpApplication.Application_Start() in c:\Projects\Ninject\Maintenance2.2\ninject.web.mvc\mvc3\src\Ninject.Web.Mvc\NinjectHttpApplication.cs:line 77

It would be nice to be able to use Errlusion and Ninject together so any help resolving this issue is greatly appreciated.

-James