Reputation: 1852
We have this very strange error in Asp.Net MVC 4 Razor whereby within the View, we have the following code:
@Html.InlineEditingContentText(CS.General_v4.Enums.HtmlTagName.Span, VisitGozo.Enums.VisitGozoEnums.ContentTextIdentifier.MasterPage_Weather_Title, "weather-widget-title masterpage-widget-title")
InlineEditingContentText
is an extension method which we have internally. The 2nd parameter being passed is an enumeration parameter and as you can see from above, the value is VisitGozo.Enums.VisitGozoEnums.ContentTextIdentifier.MasterPage_Weather_Title
. Now when you debug into the extension method InlineEditingContentText
, the actual 2nd parameters being received is not VisitGozo.Enums.VisitGozoEnums.ContentTextIdentifier.MasterPage_Weather_Title
but VisitGozo.Enums.VisitGozoEnums.ContentTextIdentifier.MasterPage_Header_LoggedOutText
which happens to be the next value of the ContentTextIdentifier enumeration after VisitGozo.Enums.VisitGozoEnums.ContentTextIdentifier.MasterPage_Weather_Title
.
We are not assigning values to the enumerations and so their respective int
values increment after each other automatically.
Any possible insight into why this strange issue is happening?
Edit #1: Also, when we uploaded the website on the deployment server, after compiling using same workstation, the error was carried over as well
Edit #2: 2013-10-22 > We are still getting this same problem, even when then deploying the files on the actual production server, such incorrect enum values are being carried over. The only way to solve the issue is to delete the Views from the server / locally, and re-overwriting them again. Any idea how we can solve this issue? We shouldn't be caching Views so can't really understand why this is happening? Would appreciate any form of help!
Upvotes: 2
Views: 808
Reputation: 26647
Most likely cached files have not been cleaned. It might happen occasionally.
If you use IIS delete corresponding Temporary ASP.NET folder. For example, if your project is 64bit Framwork 4.0 then path would be: %WinDir%\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\
If you use IIS Express or similar you might need to stop it and start again.
Updating Razor file forced dynamic compilation and that solved the your issue.
Upvotes: 1