Skip to content

Improve error reporting for dynamic method invocation via reflection #97022

Closed
@Nefcanto

Description

@Nefcanto

When we invoke a method via reflection, in case something goes wrong with type matching we get this error:

Object does not match target type.

This is a very poor message for debugging. Please give us more information. Something like:

You wanted to invoke SomeMethod and you passed X of type XType with value XValue and Y with type YType. These types do not match with what SomeMethod expects as its parameters A of type AType and B of type BType.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Reflectiongood first issueIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions