Skip to content

DispatchProxy invoke method returning GenericType with constraint TypeLoadException #31485

Closed

Description

DispatchProxy seems to have a bug (from my point of view at least).

Here's a dotnetfiddle to illustrate my point:
https://dotnetfiddle.net/Lu1iSN

The method with this signature cannot be proxied and throws an exception:
IGenericHandler GetHandler(T input) where T : GenericBase
Unhandled exception. System.TypeLoadException: GenericArguments[0], 'T', on 'IGenericHandler`1[T]' violates the constraint of type parameter 'T'.
at generatedProxy_1.GetHandler[T]
at Program.Main()

Is it a bug/limitation or am I doing something wrong?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions