Skip to content

Type.GetInterfaceMap(Type) does not throw for open generic types #9310

Open
@Xriuk

Description

@Xriuk

Description

According to the docs:

Exceptions
ArgumentException
...
The current instance or interfaceType argument is an open generic type; that is, the ContainsGenericParameters property returns true.

The current instance I guess it refers to the type on which the method is called, which in my examples below is always an open type, and it does not throw for that.
While the interfaceType argument only throws if I manually write it as an open generic, while if I retrieve it through reflection it does not.

Reproduction Steps

See fiddle: https://dotnetfiddle.net/8698i5

Expected behavior

According to the docs it should always throw

Actual behavior

It throws only if both types are specified as open generics through typeof() and not via reflection

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions