TimeZoneNotFoundException: Exception of type 'System.TimeZoneNotFoundException' was thrown.

Options
SniperED007
edited May 2019 in Photon Voice
We getting a lot of issues like this in Production on Windows machines where calling DateTime.now throws the following errors: TimeZoneNotFoundException: Exception of type 'System.TimeZoneNotFoundException' was thrown.

In my own code wherever I use DateTime.Now I changed it to use DateTime.UtcNow which then doesn't throw the above error.

I'm using .NET 4.x for both Scriping and API Compatibility and using Mono.
These errors are taken from the Unity Dashboard - Problem report:

TimeZoneNotFoundException: Exception of type 'System.TimeZoneNotFoundException' was thrown.

Managed Stack Trace:

ExitGames.Client.Photon.Voice.RemoteVoice.decodeThread (ExitGames.Client.Photon.Voice.IDecoder decoder) (at <3fbbaa892798415ea038eb235c076071>:0)
ExitGames.Client.Photon.Voice.RemoteVoice.<.ctor>b__10_0 () (at <3fbbaa892798415ea038eb235c076071>:0)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
System.Threading.ThreadHelper.ThreadStart () (at <1f0c1ef1ad524c38bbc5536809c46b48>:0)
UnityEngine.UnhandledExceptionHandler:m__0(Object, UnhandledExceptionEventArgs)

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @SniperED007,

    Thank you for your report.

    How can we reproduce this with minimal steps?
    Where do you use DateTime.Now?
    What Photon Voice version are you using?
  • vadim
    Options
    Hi

    While using DateTime.UtcNow may be a good idea since we never need timezone in Voice code, it can not guarantee that DateTime.Now doesn't get called somewhere else. For instance, I do not see which call caused the crash shown in your stack. Maybe it's outside of Voice code scope.
    Can you check if machine timezone configured correctly? Maybe runtime is not familiar with timezone currently set?
    Also you can try to replace all calls in your local project (replace all in /Assets files ) and see if it helps.