Skip to content

Possible misfiring of RS0026 #6264

Open

Description

Analyzer

Diagnostic ID: RS0026: Do not add multiple overloads with optional parameters

Analyzer source

NuGet Package: Microsoft.CodeAnalysis.PublicApiAnalyzers

Version: 3.3.3 (Latest)

Describe the bug

The documentation for this error suggests that the issue is multiple overloads where the differentiating parameters are optional. However, this will fire for multiple overloads that are always differentiable just because both have optional parameters.

Steps To Reproduce

public class MyClass
{
    public MyClass(string name, string connectionString, Action<object> options = null, bool exactName = false) { }
    public MyClass(string name, IDbConnection connection, bool exactName = false) { }
}

Expected behavior

No error, or documentation that explains why this is a compat problem.

Actual behavior

RS0026

Additional context

Adding the analyzer to an existing project to track its API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions