Monday, December 7, 2009

ASP.NET MVC GetTypeHashCode() no suitable method found to override

I was getting this error when running a page from an ASP.NET MVC site and it was driving me batty:

Error Message: c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files!!!!!oot\296bde83\3fd88bdf\App_Web_create.aspx.1486a709.vkhqok-s.0.cs(291): error CS0115: 'ASP.views_mycontroller_create_aspx.GetTypeHashCode()': no suitable method found to override

I fixed it by deleting the old view and creating a new one and then just pasting in the bits I'd already done testing it after each paste to see what it was. This showed nothing.

I then compared the old view with the new one and discovered that the only difference was in the @page directive:

Old View: Inherits="System.Web.Mvc.ViewUserControl<Model.EditorViewModel>"

New View: Inherits="System.Web.Mvc.ViewPage<Model.EditorViewModel>"

Not sure how I ended up with ViewUserControl in the old view instead of ViewPage but this was my error and fixed the problem.


  1. Thank you, just saved me. Mine was a result of a copy paste crime.

  2. Thanks bro! Good one!!! I was having the same problem... lol

  3. You sir, are a Scholar and a Gent! I have been wrestling this issue for the last hour and changing ViewUserControl to ViewPage made the page load instantly! Copy Pasta was indeed the cause but this was the fix! Legend! :)

  4. yah same thing was happend wit me.. calling UC on directive.. lol... thnx! saves a lot o tym..

  5. Hey man, you solved my problem here in Brazil. Thanks!