I have a multi-lingual Sitecore site and in one of the page views, a single string property of the model is always throwing NullRefEx, even when it has a value.
<span class="category">@Model.Category</span> <!-- works as usual -->
<h1>@Model.Name</h1> <!-- throws NullRefEx on any value -->
I've put a breakpoint where I set the Name value and inside the view. In both cases, the property has a string value. What is even stranger is that Model.Category is fine rendering even with empty string value, only Model.Name complains. What is even stranger is that Model.Name complains only when I change the page language from the default to another one. I even tried putting null checks in the view and assigning a value to Name through the immediate window - it keeps throwing NullRef.
I tried restarting VS2012 and rebuilding the project.
Here is the exception
[NullReferenceException: Object reference not set to an instance of an object.]
ASP._Page_Views_ProjectName_Details_cshtml.Execute() in c:\<top secret stuff right here>\Details.cshtml:38
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +160
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +103
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +362
System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +30
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +416
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +416
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +398
EDIT: How is the other question answering mine? I don't see any case that fits mine. Clearly my Model is not null (Category renders fine). Also, my Name property has a string value when I put a breakpoint on it. Adding null-checks on both Model and Model.Name did nothing - I still got NullRefEx.