Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
thomaslevesque opened this issue Sep 24, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@thomaslevesque
Copy link
Member

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.

@blairconrad blairconrad transferred this issue from FakeItEasy/FakeItEasy Dec 8, 2019
@thomaslevesque thomaslevesque added the enhancement New feature or request label Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant