-
Notifications
You must be signed in to change notification settings - Fork 33
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
False positive with named arguments (AV1555) #145
Comments
Why do you consider this a false positive? As far as I'm aware, the analyzer matches the rule definition. |
I was expecting this to only trigger for my own code. In this case, I'm using a method in a package I don't control. AV1555 states this as an exception. |
Are you referring to:
Because that applies to booleans only. |
Crap. You're right (as usual). Well, I'm going to change the guidelines. I think it can really help when working with external libraries. |
I'm looking forward to what you have in mind. Putting the lambda parameter names in code clarifies what the callback is supposed to accomplish, which is hard to guess from your example when not inside an IDE. So I see how this improves readability. It makes sense to allow that. Does this apply specifically to parameters that return a builder.Services.AddDbContext<AppDbContext>(optionsAction: options => // allow
options.UseNpgsql(npgsqlOptionsAction: npgsqlOptions => npgsqlOptions.EnableRetryOnFailure())); // warn On the other hand, detecting "my own code" is a bit problematic as well. An analyzer can ask the compiler if source code is available for the method being called, but that only works when everything is built from source (so in a single solution). As soon as the team starts splitting things up (frontend/backend solutions, or build their own NuGets), it won't trigger the warning anymore because it now has become "external" code, as far as the analyzer is aware. |
@dennisdoomen I'd like to close this issue, because the conversation has stalled and this isn't the best place to discuss. If you still want to pursue this, can you please open an issue at https://github.com/dennisdoomen/CSharpGuidelines, pointing to this conversation? |
Analyzer
Example: AV1555 : Parameter 'configureTelemetryConfiguration' in the call to 'ApplicationInsightsLoggingBuilderExtensions.AddApplicationInsights(ILoggingBuilder, Action, Action)' is invoked with a named argument
Repro steps
The following code triggers AV1555, even though it's invoking a Microsoft NuGet package
Expected behavior
Should not complain about it
Actual behavior
Complains about it ;-)
The text was updated successfully, but these errors were encountered: