2

I have an EditorFor HTML helper in my MVC3 Razor view as follows:

@Html.EditorFor(x => x.RouteOfReferral,
                MVC.Shared.Views.EditorTemplates.TabValidationMessage, 
                new { 
                      ValidationPropertyName = ogt.PropertyName(
                         x => x.RouteOfReferral) 
                    }
               )

On the entity, I changed the type of the property from one reference data type to another, updated the viewmodel to reflect this, ran all my tests and all passed.

However, when I went to the page through the UI, I got this exception:

System.MissingMethodException
Method not found:'MyProject.Entities.ReferenceData.Entity.RouteOfReferral 
MyProject.Entities.ReferenceData.Entity.get_RouteOfReferral()'.

The strange thing is that, I commented out the HTML helper, refreshed the page, and it opened as usual. I then uncommented the HTML helper and the page opened as usual again and was fine from then on.

The problem is, now that I have deployed to the integration test platform, the same problem has occurred.

Any ideas?

Mark Dickinson
  • 6,573
  • 4
  • 29
  • 41
Declan McNulty
  • 3,194
  • 6
  • 35
  • 54

1 Answers1

5

I'm surprised this hasn't got an answer in 4 years. I just had the same problem myself and this was the top answer on Google.

Luckily, I have the answer - clear out your temporary ASP.net files.

You can use this one-line powershell:

Get-ChildItem “C:\Windows\Microsoft.NET\Framework*\v*\Temporary ASP.NET Files” -Recurse | Remove-Item -Recurse

Or any of the methods detailed here.

Just remember that on a 64 bit system with a 64bit application, the temporary files will be in the C:\WINDOWS\Microsoft.NET\Framework64\... folder instead of the C:\WINDOWS\Microsoft.NET\Framework\... folder.

Community
  • 1
  • 1
Kushan
  • 1,200
  • 12
  • 22
  • 1
    I was getting this error when updating and HtmlHelper extension method that my razor views were using. This solution still works 9 years after the OP – Dave B 84 Mar 30 '21 at 14:53