-
Notifications
You must be signed in to change notification settings - Fork 480
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
Check List: Validate arguments of public methods #5047
Comments
@davidfowl @eerhardt |
It seems to duplicate of #2649 |
Really. Then you need to understand whether this solution option is suitable and make adjustments if necessary. |
@DamianEdwards But this requires a go-ahead, |
I will work on Aspire.Hosting.Elasticsearch. |
I will work on Aspire.Hosting.Nats |
I will work on Aspire.Hosting.Keycloak |
I will work on Aspire.Hosting.Milvus |
I will work on Aspire.Hosting.PosgreSQL |
I will work on Aspire.Hosting.RabbitMQ |
I will work on Aspire.Hosting.MySql |
I will work on Adding public API test coverage for Aspire.Hosting.Kafka |
I will work on Adding public API test coverage for Aspire.Hosting.Garnet |
I will work in Aspire.Hosting.NodeJs |
I will work in Microsoft.Extensions.ServiceDiscovery.Yarp |
Add groups Components.* and ServiceDiscovery.* |
hmm, a lot of work :) |
I will work on Aspire.Elastic.Clients.Elasticsearch |
I will work on Aspire.Milvus.Client |
I will work on Aspire.MongoDB.Driver |
I will work on Aspire.Hosting.MongoDB |
I will work on Microsoft.Extensions.ServiceDiscovery.Dns |
I will work in Aspire.NATS.Net |
I will work on Aspire.Hosting.SqlServer |
@Alirexaa @Zombach Could you make these in batches, it might help reduce the noise and we are on agreement with how these should be done so the back-and-forth should be minimal. Thanks. Mayube one for clients and one for hosting, and if one of you owns it in the fork then they could invite the other so they can work on the same branch if necessary (I can already as a contributor of this repos). Then when I merge I will keep both names as contributors for internet points. |
Yes, okay. We will do this in blocks. |
I'm working with @Alirexaa on #5250 |
I'm working on #5402 |
I'm working on #5407 |
These projects are frozen for now, since they have not yet moved the test projects into a separate project. Aspire.Hosting.AppHost |
Is your feature request related to a problem? Please describe the problem.
Check List to #2649
Source CA1062
Cause
An externally visible method dereferences one of its reference arguments without verifying whether that argument is null (Nothing in Visual Basic).
You can configure this rule to exclude certain types and parameters from analysis. You can also indicate null-check validation methods.
Rule description
All reference arguments that are passed to externally visible methods should be checked against null. If appropriate, throw an ArgumentNullException when the argument is null.
If a method can be called from an unknown assembly because it is declared public or protected, you should validate all parameters of the method. If the method is designed to be called only by known assemblies, mark the method internal and apply the InternalsVisibleToAttribute attribute to the assembly that contains the method.
Describe the solution you'd like
I suggest covering this with additional tests.
Check every reference argument in the public API
ArgumentNullException.ThrowIfNull(source)
.Using the example of Aspire.Hosting.Redis
RedisBuilderExtensions.cs
Attached as an full example CA1062#Aspire.Hosting.Redis
Additional context
When checking, we get a NullReferenceException
Components.*
Hosting.*
ServiceDiscovery.*
Frozen*
The text was updated successfully, but these errors were encountered: