Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActivationManager Exception during build process?

Tags:

I'm getting the following exception when building a website project in VS 2010:

The pre-application start initialization method Run on type WebActivator.ActivationManager  threw an exception with the following error message: Exception has been thrown by the target of an invocation..      

How do I go about debugging this? It's happening when I build in VS.NET and from the command-line (e.g., via NAnt/MSBuild).

like image 408
mtutty Avatar asked Nov 15 '11 00:11

mtutty


1 Answers

To solve this, you need to supply the -errorstack argument to the aspnetcompiler. Then when it fails, you'll get not only the stack trace of the exception you're seeing now, but also the InnerException that it's wrapping. For instance, here's the output when the build error is caused by a problem with a Cassette dll not being loaded:

    error ASPRUNTIME: The pre-application start initialization method Run on type We bActivator.ActivationManager threw an exception with the following error message : Exception has been thrown by the target of an invocation..  [TypeLoadException]: Could not load type 'Cassette.Configuration.ICassetteConfig uration' from assembly 'Cassette, Version=0.8.1.0, Culture=neutral, PublicKeyTok en=null'.    at Cassette.Web.StartUp..cctor()  [TypeInitializationException]: The type initializer for 'Cassette.Web.StartUp' t hrew an exception.    at Cassette.Web.StartUp.PreApplicationStart()  [TargetInvocationException]: Exception has been thrown by the target of an invoc ation.    at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Ob ject target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAt tributes, RuntimeType typeOwner)    at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Obj ect target, Object[] arguments, Signature sig, MethodAttributes methodAttributes , RuntimeType typeOwner)    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke Attr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisib ilityChecks)    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke Attr, Binder binder, Object[] parameters, CultureInfo culture)    at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)    at WebActivator.BaseActivationMethodAttribute.InvokeMethod()    at WebActivator.ActivationManager.RunActivationMethods[T]()    at WebActivator.ActivationManager.RunPreStartMethods()    at WebActivator.ActivationManager.Run()  [InvalidOperationException]: The pre-application start initialization method Run  on type WebActivator.ActivationManager threw an exception with the following er ror message: Exception has been thrown by the target of an invocation..    at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection` 1 methods)    at System.Web.Compilation.BuildManager.CallPreStartInitMethods()    at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appMan ager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, Host ingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception a ppDomainCreationException)  [HttpException]: The pre-application start initialization method Run on type Web Activator.ActivationManager threw an exception with the following error message:  Exception has been thrown by the target of an invocation..    at System.Web.Compilation.ClientBuildManager.EnsureHostCreated()    at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuil dManagerCallback callback, Boolean forceCleanBuild)    at System.Web.Compilation.Precompiler.Main(String[] args) 
like image 60
Bryn Keller Avatar answered Sep 19 '22 15:09

Bryn Keller