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

Problem with constructors #35

Open
antonKrizmanic opened this issue Aug 8, 2024 · 1 comment
Open

Problem with constructors #35

antonKrizmanic opened this issue Aug 8, 2024 · 1 comment

Comments

@antonKrizmanic
Copy link

Hi, I have problem with the way how you implemented some of your constructors. Classes that I found for now with that implementation are SmsTextualMessage and SmsAdvancedTextualRequest.

Both have all parameters as optional, but in implementation of constructor there is check if some parameters are null.
For example:

var smsRequest = new SmsAdvancedTextualRequest()
{
    Messages = [smsMessages]
};

will built without any error, but during execution exception will be thrown because of:

public SmsAdvancedTextualRequest(string bulkId = null, List<SmsTextualMessage> messages = null, SmsSendingSpeedLimit sendingSpeedLimit = null, SmsUrlOptions urlOptions = null, SmsTracking tracking = null, bool includeSmsCountInResponse = false)
{
    Messages = messages ?? throw new ArgumentNullException("messages");
    BulkId = bulkId;
    SendingSpeedLimit = sendingSpeedLimit;
    UrlOptions = urlOptions;
    Tracking = tracking;
    IncludeSmsCountInResponse = includeSmsCountInResponse;
}

I would expect build time error for this case

@davorivankovic
Copy link

Hi @antonKrizmanic,

Thank you for reporting this. We'll take a look and get back to you with more information.

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants