I have created a view using Servicestack.Razor. On the view page I am trying to get the session using following code.
var session = GetSession<AuthUserSession>().ToJson();
When I put this code on the view page, I get following error:
System.TimeZoneNotFoundException
Exception of type 'System.TimeZoneNotFoundException' was thrown.
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.
StackTrace is as below:
Exception stack trace:
at System.TimeZoneInfo.get_Local () [0x00000] in <filename unknown>:0
at ServiceStack.Text.Common.DateTimeSerializer..cctor () [0x00000] in <filename unknown>:0
Is this a bug in Servicestack.Text? How can I solve this?
Note: I am using Mono 3.0.10 on Ubuntu 12.10
Mono has a known & longstanding Timezone bug that affects Windows but it SHOULD work in Linux as long as the TimeZone database is installed at /usr/share/zoneinfo. However, that's exactly the same error I get in Windows if I try to serialize a date, so that would make me think that for some reason, /usr/share/zoneinfo is out of place.
If it's NOT there, the workaround in Comment 6 may help you. But then I believe you have to resort to building ServiceStack.Text from sources so you can apply the workaround.
It might be easier to create a symbolic link at /usr/share/zoneinfo that points to wherever it actually is installed.