Please, help me to explain the following behavior:
dynamic d = 1;
ISet s = new HashSet();
s.Contains(d);
The
The Contains method is defined on ICollection, not ISet. The CLR doesn't allow an interface base method to be called from a derived interface. You usually doesn't see this with static resolution because the C# compiler is smart enough to emit a call to ICollection, not the non-existing ISet.
Edit: The DLR mimics the CLR behavior, that's why you get the exception. Your dynamic call is done on an ISet, not an HashSet the DLR will mimics the CLR: for an interface, only interfaces methods are searched for, not base interfaces (contrary to classes where this behavior is present).
For an in-depth explanation, see a previous response of mine to a similar question:
Strange behaviour when using dynamic types as method parameters