Problems with Glimpse on MVC5 / EF6 / ASP.Net 4.51 .. “Constructor on type ‘Castle.Proxies.IViewProxy_1’ not found.”

Problems when you enable Glimpse on a site using MVC 5, EF6 and .Net 4.51 was getting this exception on the site (repro’d in text to be a little more searchable), it is:

Server Error in ‘/’ Application.


Constructor on type ‘Castle.Proxies.IViewProxy_1’ not found.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.MissingMethodException: Constructor on type ‘Castle.Proxies.IViewProxy_1’ not found.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[MissingMethodException: Constructor on type 'Castle.Proxies.IViewProxy_1' not found.]
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1138
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +124
   System.Activator.CreateInstance(Type type, Object[] args) +79
... etc

 

or:

MVC5 EF6 and glimpse

this one was reported as a problem on GitHub but doesn’t look like it will go away soon.

the fix is to just delete the file Glimpse.Mvc4.dll from your bin directory after a rebuild. However every rebuild will see it re-appear as, until the NuGet packages are updated, you’ll just get it reappearing each time.

Quick fix to get rid of this during development, right click the ASP.Net MVC project, click properties, click on Build Events, and then click the button “Edit Post Build”, then enter the following:

del $(TargetDir)Glimpse.Mvc4.dll /Q

this will automatically remove the unwanted DLL each time you rebuild. If the file is not there (when the NuGet packages are fixed), you’ll probably get an error to say the command line failed, but for now should be enough to do the job.

 

Advertisements