Skip to content

Add diagnostic for incorrect delegate signature for ReturnsLazily, Invokes, etcΒ #4

@thomaslevesque

Description

@thomaslevesque

Passing a delegate with an incorrect signature to a method like ReturnsLazily, Invokes, etc. results in an error at runtime. This error is thrown when the faked method is called, not when it's configured, making it difficult to locate the origin of the problem (unfortunately it's not possible to check the signature at configuration time).

It would be much better to detect this at design/compile time, using a Roslyn analyzer.

Id: FakeItEasy0008 (assuming we also implement FakeItEasy0007)
Title: Incorrect delegate signature.
Message: Incorrect delegate signature. The faked method has the signature , but was used with .
Severity: Error

We could try to implement a code fix for this; not sure how hard that would be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions