Giter Club home page Giter Club logo

Comments (7)

Jericho avatar Jericho commented on June 21, 2024 1

Thanks for reporting this and for the additional information. I'll look into it this weekend and report back what I find.

from stronggrid.

Jericho avatar Jericho commented on June 21, 2024 1

I still can't explain why this problem is occurring, but I can confirm that I am able to reproduce it when I create a new .net7 console app and reference the latest StrongGrid package from NuGet (which, by the way, targets .net5 and .net6). Is the problem related to some quirk when referencing a .net6 library from a .net7 project?

Maybe this is an argument in favor of expediting #463?

So far, I already faced (and fixed) one serialization problem caused by a change introduced in .net7 (explanation here, I fixed it here). This might be another similar situation.

I'm continuing my research...

from stronggrid.

Jericho avatar Jericho commented on June 21, 2024 1

I found the culprit and I know how to fix the issue, but I still can't explain why this problem occurs only when our library targets .net6 and it's used in a .net7 application.

An update should be available on NuGet tomorrow.

from stronggrid.

ken-swyfft avatar ken-swyfft commented on June 21, 2024

FWIW, this little bit in Program.cs reproduces the problem. It seems to be the MailPersonalization.CustomArguments that is the issue - comment that stuff out and it'll work without an error:

using StrongGrid;
using StrongGrid.Models;
using MailAddress = StrongGrid.Models.MailAddress;

const string sendGridKey = "your sendgrid key";

Console.WriteLine("Sending email...");

var client = new Client(sendGridKey);
var personalization = new MailPersonalization
{
    To = new[] { new MailAddress("[email protected]", "Ken Smith") },
    CustomArguments = new KeyValuePair<string, string>[]
    {
        new ("PolicyNumber", "some policy number"),
        new ("PolicyHolder", "some email address"),
    },
};

var contents = new List<MailContent>
{
    new("text/plain", "Hello plain world!"),
};

var result = await client.Mail.SendAsync(new List<MailPersonalization> { personalization },
    "Test Subject",
    contents,
    new MailAddress("[email protected]", "Ken Smith"),
    new List<MailAddress> { new("[email protected]", "Ken Smith") }
);

Console.WriteLine($"Sent email: {result}");
Console.ReadLine();

from stronggrid.

Jericho avatar Jericho commented on June 21, 2024

🎉 This issue has been resolved in version 0.95.1 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

from stronggrid.

ken-swyfft avatar ken-swyfft commented on June 21, 2024

I found the culprit and I know how to fix the issue, but I still can't explain why this problem occurs only when our library targets .net6 and it's used in a .net7 application.

An update should be available on NuGet tomorrow.

Thank you so much! I tested out the update in our solution, and it's resolved the problem.

from stronggrid.

Jericho avatar Jericho commented on June 21, 2024

Excellent! Thank you for confirming.

from stronggrid.

Related Issues (20)

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.