Giter Site home page Giter Site logo

sendgrid-netcore's People

Contributors

joshcomley avatar

Stargazers

 avatar  avatar Li Junkang avatar Mads Dørup avatar

Watchers

 avatar James Cloos avatar Surjit avatar  avatar

sendgrid-netcore's Issues

Issue found in Serialize method under the Utils class.

I have user without core version of library. In my case I am using the template and my parameter dynamically send from my code. When I have used this utility found bug while Serialize the object. Below is the method is used in code

`using (var jsonWriter = new JsonTextWriter(writer))
{
serializer.Serialize(jsonWriter, objectToSerialize);
return jsonWriter.ToString();

//Console.WriteLine(writer.ToString());

}`
This method not created json string properly. So I have change the code as below.

`using (var jsonWriter = new JsonTextWriter(writer))
{
//serializer.Serialize(jsonWriter, objectToSerialize);
//return jsonWriter.ToString();

return JsonConvert.SerializeObject(objectToSerialize).ToString();
    //Console.WriteLine(writer.ToString());

}`

After that all is working fine. It will help some who uses the templates. Please comment is there any better option available that this.

SendGrid.SmtpApi.Utils

public static string Serialize<T>(T objectToSerialize)
        {
            if (objectToSerialize == null)
                throw new ArgumentNullException("A key or value in your X-SMTPAPI header is null.");
            var serializer = JsonSerializer.Create();
            using (var writer = new StringWriter())
            {
                using (var jsonWriter = new JsonTextWriter(writer))
                {
                    serializer.Serialize(jsonWriter, objectToSerialize);
                    // return jsonWriter.ToString(); 
                    return writer.ToString();
                }
            }
        }

Compatibility with ASP.NET Core 1.1.0

Unfortunately, this library is not compatible with the just released version of aspnet core 1.1.0 because of the referenced Microsoft.AspNet.WebApi.Client 5.2.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.