Cannot inherit interface '<interfacename1>' because it could be identical to interface '<interfacename2>' for some type arguments

A generic interface inherits more than once from another generic interface, 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 derivedInterface(Of t1, t2)

Inherits interfaceA(Of t1), interfaceA(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: BC32120

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