Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access modifier issue in SingleSend model #508

Closed
fantakim opened this issue Feb 14, 2024 · 3 comments
Closed

Access modifier issue in SingleSend model #508

fantakim opened this issue Feb 14, 2024 · 3 comments
Assignees
Labels
Breaking Change This change causes backward compatibility issue(s)
Milestone

Comments

@fantakim
Copy link

Hello,

I've encountered an issue while using the client.SingleSends.GetAsync method where certain properties are not binding as expected. Specifically, attempting to access the EmailConfig and SendTo properties of the SingleSend model results in a NullReferenceException. This issue likely arises because these properties are designed for internal use, as indicated by their current accessibility level.

Furthermore, the related models SingleSendEmailConfig and SingleSendSendTo are also set to internal access modifiers, making it necessary to change their accessibility to public to allow external access.

https://github.com/Jericho/StrongGrid/blob/develop/Source/StrongGrid/Models/SingleSend.cs#L218-L221

@Jericho
Copy link
Owner

Jericho commented Feb 14, 2024

Thanks for reporting this issue. It appears this problem was introduced in January 2022 in release 0.87.0 when we replaced Newtonsoft's JSON library with Microsoft's System.Text.Json due to the fact that Microsoft's Json parser does not deserialized private members (such as SingleSend.EmailConfig and SingleSend.SendTo in this instance) while Newtonsoft's parser did deserialize such private members.

Let me think about how I'm going to overcome to limitation...

@Jericho Jericho self-assigned this Feb 14, 2024
@Jericho Jericho added the Bug This change resolves a defect label Feb 14, 2024
@Jericho
Copy link
Owner

Jericho commented Feb 14, 2024

As you hinted in your original comment, the simplest solution is to change the EmailConfig and the SendTo properties to public and do the same to their corresponding model classes.

When I do that, several properties on the SingleSend class will become redundant (such as Subject and HtmlContent for example). Therefore I will remove these redundant properties.

Finally, I will use this opportunity to rename SendTo to Recipients which is much clearer.

@Jericho Jericho added Breaking Change This change causes backward compatibility issue(s) and removed Bug This change resolves a defect labels Feb 14, 2024
@Jericho Jericho added this to the 0.106.0 milestone Feb 14, 2024
@Jericho
Copy link
Owner

Jericho commented Feb 16, 2024

🎉 This issue has been resolved in version 0.106.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change This change causes backward compatibility issue(s)
Projects
None yet
Development

No branches or pull requests

2 participants