Cannot inherit interface '<interfacename1>' because the interface '<interfacename2>' from which it inherits could be identical to interface '<interfacename3>' from which the interface '<interfacename4>' inherits for some type arguments

A generic interface inherits from two or more generic interfaces, and two of the inheritances could conflict for certain values of type arguments.

The following statements can generate this error.

Public Interface interfaceA(Of u)
End Interface
Public Interface interfaceX(Of v)
    Inherits interfaceA(Of v)
End Interface
Public Interface interfaceY(Of w)
    Inherits interfaceA(Of w)
End Interface
Public Interface derivedInterface(Of t1, t2)
    Inherits interfaceX(Of t1), interfaceY(Of t2)
End Interface

If derivedInterface is constructed or implemented supplying the same type to both t1 and t2, it must inherit two versions of interfaceA with identical type arguments. Doing so would produce an ambiguity about which version to access.

Error ID: BC32122

To correct this error

  • Change one of the type arguments supplied to the derived interface so that there is no conflict.

    -or-

  • Remove from the Inherits statement one of the interfaces causing the potential inheritance or implementation conflict.

See Also

Concepts

Interfaces Overview

Inheritance Basics

Generic Types in Visual Basic

Reference

Interface Statement (Visual Basic)

Inherits Statement