ServiceStack Razor returns NullReferenceException

ServiceStack Razor view returns NullReferenceException but all the other formats(Json, XML, JSV) return the correct data without any problem. The error doesn’t happen consistently so it is hard to debug. Attached is the error message.

That’s saying there’s a null reference error, first step is getting the StackTrace to identify where it’s occurring. Check your logs, if it’s not there you’d need to enable DebugMode.

More detail if it helps.

Look at line 8 in your .cshtml to investigate the issue, try reverting the last thing added, temporarily remove potential lines could cause it, etc.

Thank you. I will go forward from here.

It looks like the return object(‘Model’) is only null for the razor view but not for the other formats(json, xml, jsv, …). And this happens only after a session timeout. I still have to do some research why this the case.