Skip to content

invalid IDE0028 (explicit interface implementation) #23672

@ufcpp

Description

@ufcpp

Version Used:

VS 15.5.0

Steps to Reproduce:

using System.Collections.Generic;
using System.Dynamic;

class Program
{
    static void Main()
    {
        // ExpandoObject doesn't have public Add method. Its Add is explicit implementation of IDictionary.
        IDictionary<string, object> obj = new ExpandoObject();
        obj.Add("string", "v");
        obj.Add("int", 1);
        obj.Add("object", new { X=1, Y=2 });
    }
}
  1. IDE0028 Quick Action
IDictionary<string, object> obj = new ExpandoObject
{
    // Error CS1061 'ExpandoObject' does not contain a definition for 'Add'
    { "string", "v" },
    { "int", 1 },
    { "object", new { X = 1, Y = 2 } }
};

Expected Behavior:

No IDE0028 suggestion.

Actual Behavior:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEBughelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions