twilio-csharp icon indicating copy to clipboard operation
twilio-csharp copied to clipboard

Serializing MessageResource response object using Newtonsoft throws error

Open CodeFisher-02 opened this issue 5 years ago • 4 comments

Issue Summary

Serialization of MessageResource with Newtonsoft.json fails when in place of 'from' parameter , 'messagingserviceid' is provided

Code Snippet

 private async void CreateMessageResourceAsync(string serviceId, string recipient, string body)
MessageResource  message = await MessageResource.CreateAsync
            (
                body: body,
                messagingServiceSid: serviceId,
                to: new PhoneNumber(recipient)
            );
string str = JsonConvert.SerializeObject(message)
}

Exception/Log

System.Private.CoreLib: Exception while executing function: SendSmsAsync. Newtonsoft.Json: Value cannot be null. (Parameter 'o').

Technical details:

  • twilio-csharp version: 5.46.2
  • csharp version: .net core 3.1
  • newtonsoft version: 12.0.3

CodeFisher-02 avatar Sep 09 '20 07:09 CodeFisher-02

Able to recreate this locally. Guessing it's because the from in the response is an empty string, but not positive.

This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.

childish-sambino avatar Sep 11 '20 18:09 childish-sambino

Any updates on this?

CodeFisher-02 avatar Sep 18 '20 07:09 CodeFisher-02

No update. Still in the backlog.

childish-sambino avatar Sep 18 '20 14:09 childish-sambino

Do we have any updates here

CodeFisher-02 avatar Oct 23 '20 14:10 CodeFisher-02