adamyeager / PushbulletSharp

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

Issue sending unecrypted Ephemeral Notification Request #22

Closed khm971 closed 6 years ago

khm971 commented 7 years ago

Hi, Adam, and thank you for the excellent wrapper!

I wanted to share what I think is a bug in the new Ephemeral Push code. The below statement works great: Dim Result As String = client.PushEphemeral(NotificationRequest, True)

However, this: Dim Result As String = client.PushEphemeral(NotificationRequest, False) results in the following error:

Type 'PushbulletSharp.Models.Requests.Ephemerals.NotificationEphemeral' with data contract name 'NotificationEphemeral:http://schemas.datacontract.org/2004/07/PushbulletSharp.Models.Requests.Ephemerals' is not expected. Consider using a DataContractResolver if you are using DataContractSerializer or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to the serializer.

And I believe it's happening here:

public static class PushbulletSharpExtensions { ///

/// To the json. /// /// The data. /// public static string ToJson(this object data) { var serializer = new DataContractJsonSerializer(data.GetType());

        using (MemoryStream stream = new MemoryStream())
        {
            serializer.WriteObject(stream, data);   // **** OFFENDING CODE ******
            return Encoding.UTF8.GetString(stream.ToArray(), 0, (int)stream.Length);
        }
    }

Hopefully that's useful information. If you'd like any more info, just let me know, and thanks for all of your work!

adamyeager commented 7 years ago

Good catch, and sorry that it's happening. I've got family in town today, and I should be free to look into the issue tomorrow. Hopefully I'll have it resolved for you in the next couple of days.

I'm glad to hear you're enjoying this library! :)

khm971 commented 7 years ago

Hi, Adam,

Thanks for the quick reply. Yes, I sure do enjoy your library, made my life so much easier and my code so much cleaner than the mess I was making on my own.

Enjoy your time with the family!

/\KHM

From: Adam Yeager [mailto:notifications@github.com] Sent: Saturday, November 26, 2016 8:17 AM To: adamyeager/PushbulletSharp PushbulletSharp@noreply.github.com Cc: Kevin McMahon khm@InnovativeSol.com; Author author@noreply.github.com Subject: Re: [adamyeager/PushbulletSharp] Issue sending unecrypted Ephemeral Notification Request (#22)

Good catch, and sorry that it's happening. I've got family in town today, and I should be free to look into the issue tomorrow. Hopefully I'll have it resolved for you in the next couple of days.

I'm glad to hear you're enjoying this library! :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/adamyeager/PushbulletSharp/issues/22#issuecomment-263063006, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGq0Lp-k7XT3mf4e_rMI24eJbNo49R-fks5rCDFVgaJpZM4K8yFP.

adamyeager commented 7 years ago

I've fixed this issue and it will be included in the next release (3.1). I have one other issue to finish and then I will push it to nuget.

khm971 commented 7 years ago

Thanks, Adam!

/\KHM

From: Adam Yeager [mailto:notifications@github.com] Sent: Sunday, November 27, 2016 9:33 AM To: adamyeager/PushbulletSharp PushbulletSharp@noreply.github.com Cc: Kevin McMahon khm@InnovativeSol.com; Author author@noreply.github.com Subject: Re: [adamyeager/PushbulletSharp] Issue sending unecrypted Ephemeral Notification Request (#22)

I've fixed this issue and it will be included in the next release (3.1). I have one other issue to finish and then I will push it to nuget.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/adamyeager/PushbulletSharp/issues/22#issuecomment-263125502, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGq0LtSK50k8n1qi63U2RYxPRY2HUEO1ks5rCZSjgaJpZM4K8yFP.

emanuelgaspar commented 6 years ago

Hi Adam.

First of all, thanks for your great work with this package.

Having faced the "data contract name" issue just now, I'm writing this message as a friendly ping to remind you to release the new 3.1 version.

Thanks, Emanuel

adamyeager commented 6 years ago

I just uploaded a new version of PushbulletSharp to nuget (3.1.0). It should show up very soon and it addresses this issue.