ChrisWebb
ChrisWebb

Reputation: 395

Parse exception on SaveAsync()

Occasionally (about 1 in 6 times) when attempting to create then save a parseObject, I get the following exception thrown

at System.DateTime.ParseExact (System.String s, System.String[] formats, IFormatProvider provider, DateTimeStyles style) [0x00000] in :0 at System.DateTime.ParseExact (System.String s, System.String format, IFormatProvider provider, DateTimeStyles style) [0x00000] in :0 at System.DateTime.ParseExact (System.String s, System.String format, IFormatProvider provider) [0x00000] in :0 at Parse.ParseClient.ParseDate (System.String input) [0x00000] in :0 at Parse.ParseObject.MergeMagicFields (IDictionary`2 data) [0x00000] in :0 at Parse.ParseObject.MergeFromServer (IDictionary`2 data) [0x00000] in :0 at Parse.ParseObject.MergeAfterSave (IDictionary`2 result) [0x00000] in :0 at Parse.ParseObject+c__DisplayClass1f.b__1b (System.Threading.Tasks.Task`1 t) [0x00000] in :0 at System.Threading.Tasks.TaskActionInvoker+FuncTaskInvoke`2[System.Tuple`2[System.Net.HttpStatusCode,System.Collections.Generic.IDictionary`2[System.String,System.Object]],System.Threading.Tasks.Task`1[System.Tuple`2[System.Net.HttpStatusCode,System.Collections.Generic.IDictionary`2[System.String,System.Object]]]].Invoke (System.Threading.Tasks.Task owner, System.Object state, System.Threading.Tasks.Task context) [0x00000] in :0 at System.Threading.Tasks.Task.InnerInvoke () [0x00000] in :0 at System.Threading.Tasks.Task.ThreadStart () [0x00000] in :0

I am using .net parse version 1.3.1.

The code causing the error looks like this:

ParseObject po = new ParseObject( "Journey" );
po.ObjectId = journey.ID;
po["audioCount"] = journey.AudioFiles.Count;
po["locationPointCount"] = journey.LocationPoints.Count;
po["photoCount"] = journey.PhotoFiles.Count;
po["videoCount"] = journey.VideoFiles.Count;
po["startTime"] = journey.StartTime;
po["endTime"] = journey.EndTime;
po["notes"] = journey.Notes;
po["isInProgress"] = journey.IsInProgress;

po.AddRangeUniqueToList( "audioFiles", audioFiles );
po.AddRangeUniqueToList( "photoFiles", photoFiles );
po.AddRangeUniqueToList( "videoFiles", videoFiles );

po.ACL = new ParseACL(ParseUser.CurrentUser);
po["user"] = ParseUser.CurrentUser;

await po.SaveAsync();

Thanks for any help

Edit: Removing "startTime" and "endTime" from the ParseObject does not resolve the issue.

Edit: For the sake of more information, here is the disassembly of the "MergeMagicFields" method which appears to be causing the problem. The only paths that end up calling "ParseData" appear to be related to parses internal data.

internal virtual void MergeMagicFields( IDictionary<string, object> data )
{
    lock( this.mutex )
    {
        if( data.ContainsKey( "objectId" ) )
        {
            this.SetObjectIdInternal( data["objectId"] as string );
            this.hasBeenFetched = true;
            this.OnPropertyChanged( "IsDataAvailable" );
            data.Remove( "objectId" );
        }
        if( data.ContainsKey( "createdAt" ) )
        {
            this.CreatedAt = new DateTime?( ParseClient.ParseDate( data["createdAt"] as string ) );
            data.Remove( "createdAt" );
        }
        if( data.ContainsKey( "updatedAt" ) )
        {
            this.UpdatedAt = new DateTime?( ParseClient.ParseDate( data["updatedAt"] as string ) );
            data.Remove( "updatedAt" );
        }
        if( data.ContainsKey( "ACL" ) )
        {
            ParseACL parseACL = new ParseACL( data["ACL"] as IDictionary<string, object> );
            this.serverData["ACL"] = parseACL;
            this.AddToHashedObjects( parseACL );
            data.Remove( "ACL" );
        }
    }
}

Upvotes: 0

Views: 847

Answers (1)

ChrisWebb
ChrisWebb

Reputation: 395

[In case anyone else is having this issue]

After reporting the issue to Facebook, it appears that it is an issue on their end.

You can follow progress of the issue here:

https://developers.facebook.com/bugs/789062014466095/

Upvotes: 0

Related Questions