adamyeager / PushbulletSharp

This is a simple pushbullet wrapper written in C#.
MIT License
52 stars 61 forks source link

ArgumentNullException when converting push response #12

Closed nemec closed 8 years ago

nemec commented 8 years ago

I upgraded to 2.2.0 but I am getting an error when I try to use the new ChannelTag.

Sample code:

var accessKey = "abcd";
var client = new PushbulletClient(accessKey);
var request = new PushNoteRequest
{
    Title = "test post",
    Body = "no body",
    ChannelTag = "my-channel"
};
client.PushNote(request);

Error message (this happens after the push is successfully posted to the channel):

ArgumentNullException4 
Value cannot be null.Parameter name: value 
at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
at PushbulletSharp.PushbulletSharpExtensions.UnixTimeToDateTime(String unixTime) in D:\_workarea\PushbulletSharp\PushbulletSharp\Extensions\PushbulletSharpExtensions.cs:line 53
at PushbulletSharp.PushbulletClient.ConvertBasicPushResponse(BasicPushResponse basicResponse) in D:\_workarea\PushbulletSharp\PushbulletSharp\PushbulletClient.cs:line 1085
at PushbulletSharp.PushbulletClient.PushNote(PushNoteRequest request, Boolean ignoreEmptyFields) in D:\_workarea\PushbulletSharp\PushbulletSharp\PushbulletClient.cs:line 515
at UserQuery
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
adamyeager commented 8 years ago

I'm looking into this now. I'll have it fixed soon.

adamyeager commented 8 years ago

There was an issue with converting the response from PB back to the PB# object. The Created and Modified dates were both null and it was bombing out. Your pushes should have still gotten through though. Anyway, it's fixed now in 2.2.1. Thanks for contributing. I hope this helps!