Skip to content

System.FormatException: String was not recognized as a valid DateTime. #64

@wannabuild

Description

@wannabuild

We're just using Parse for simple push notifications (for now), and we've gotten the following exception(s):

Package: com.myapp.alpha
Version: 1681
Android: 5.1.1
Manufacturer: samsung
Model: SM-G920I
Date: 05/11/2015 13:03:18

System.FormatException: String was not recognized as a valid DateTime.
            at System.DateTimeParse.ParseExact(System.String_s__System.String_format__System.Globalization.DateTimeFormatInfo_dtfi__DateTimeStyles_style.args:1337)
            at System.DateTime.ParseExact(System.String_s__System.String_format__IFormatProvider_provider.args:1337)
            at com.myapp.alpha.Parse.Internal.ParseDecoder.ParseDate(System.String_input.args:1337)
            at com.myapp.alpha.Parse.Internal.ParseObjectCoder.<Decode>b__3(System.Object_obj.args:1337)
            at com.myapp.alpha.eTime>>:invoke_TResult_T(object.args:1337)
            at com.myapp.alpha.Parse.Internal.ParseObjectCoder.extractFromDictionary[Nullable`1](IDictionary`2_data__System.String_key__System.Func`2_action.args:1337)
                        at com.myapp.alpha.Parse.Internal.ParseObjectCoder.Decode(IDictionary`2_data__Parse.Internal.ParseDecoder_decoder.args:1337)
            at com.myapp.alpha.Parse.Internal.ParseObjectController.<SaveAsync>b__2(System.Threading.Tasks.Task`1_t.args:1337)
            at com.myapp.alpha.Parse.Internal.InternalExtensions+<>c__DisplayClass1`2[System.Tuple`2[System.Net.HttpStatusCode,System.Collections.Generic.IDictionary`2[S\
ystem.String,System.Object]],Parse.Internal.IObjectState].<OnSuccess>b__0(System.Threading.Tasks.Task_t.args:1337)
            at com.myapp.alpha.Parse.Internal.InternalExtensions+<>c__DisplayClass7`1[Parse.Internal.IObjectState].<OnSuccess>b__6(System.Threading.Tasks.Task_t.args:133\
7)
                    at System.Threading.Tasks.ContinuationResultTaskFromTask`1[System.Threading.Tasks.Task`1[Parse.Internal.IObjectState]].InnerInvoke(.args:1337)
            at System.Threading.Tasks.Task.Execute(.args:1337)
            at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(.args:1337)
            at com.myapp.alpha.Parse.Internal.InternalExtensions+<>c__DisplayClass7`1[System.Threading.Tasks.Task].<OnSuccess>b__6(System.Threading.Tasks.Task_t.args:133\
7)
                    at System.Threading.Tasks.ContinuationResultTaskFromTask`1[System.Threading.Tasks.Task`1[System.Threading.Tasks.Task]].InnerInvoke(.args:1337)
            at System.Threading.Tasks.Task.Execute(.args:1337)

And all we do with Parse (for now) is the following:

public override void OnCreate()
{
     base.OnCreate();

     RegisterActivityLifecycleCallbacks(new MyLifecycleHandler());

     ...

     var info = ParseHelper.GetInfo(BuildType);
     ParseClient.Initialize(info.AppId, info.NetKey);
     var installation = ParseInstallation.CurrentInstallation;
     installation.SaveAsync();
     ParsePush.ParsePushNotificationReceived += ParsePush.DefaultParsePushNotificationReceivedHandler;

}

We don't use anything else from Parse... Just the above. Speaking of which, I feel bit funny letting the Save.Async() call dangle like that, but don't really want to await it either. Anyhow, this doesn't always happen, but does happen sometimes. I think the fix would be to go through the code and try/catch around parsing date/time strings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions