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

Add possibility to specify parameter to RPC invocation #1798

Merged
merged 4 commits into from
Sep 1, 2023

Conversation

Temppus
Copy link
Contributor

@Temppus Temppus commented Jul 24, 2023

Fixes #1796

{
MethodName = methodName ?? throw new ArgumentNullException(nameof(methodName));
Parameters = parameters ?? EmptyParameters;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave the parameter null because otherwise the user can modify the instance of the "empty" dictionary because it is not read only (immutable).

Copy link
Contributor Author

@Temppus Temppus Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @chkr1011 for review.
Would it be ok if I changed type for parameters from IDictionary to IReadOnlyDictionary ? I would like to avoid checking for null in client code if not necessary.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would indeed circumvent the issue but I am afraid that maybe some users want to change these values and use it as a way to return data to the caller as well. So I would leave it null here. If you want to avoid checking for null all the time (what I can understand) you may pass an "Empty" immutable instance on your own.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made parameters nullable as suggested.

@Temppus Temppus requested a review from chkr1011 August 27, 2023 13:03
@chkr1011 chkr1011 merged commit 5965ded into dotnet:master Sep 1, 2023
1 of 2 checks passed
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

Successfully merging this pull request may close these issues.

Add support for per request MqttRpcTopicPair specification to ExecuteAsync method
2 participants