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

Provide analyzers + code fixes for common command authoring errors #37

Closed
kzu opened this issue Nov 2, 2022 · 0 comments
Closed

Provide analyzers + code fixes for common command authoring errors #37

kzu opened this issue Nov 2, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@kzu
Copy link
Member

kzu commented Nov 2, 2022

Detect return type mismatch when implementing command handlers.

image

image

image

kzu added a commit that referenced this issue Nov 2, 2022
Implementing command handlers is a bit tricky when the command returns a value, since you need to specify both the command type and its return type in the ICommandHandler<T, TResult> declaration. Changes in the command definition (adding a return type or changing it) result in hard to read compiler errors which can be discouraging.

The new analyzer will detect these situations:
- Missing return type for a non-void command
- Mismatched return type

And we offer code fixers that fix both scenarios, including rewriting the Execute method to have the correct return type.

Closes #37
kzu added a commit that referenced this issue Nov 2, 2022
Implementing command handlers is a bit tricky when the command returns a value, since you need to specify both the command type and its return type in the ICommandHandler<T, TResult> declaration. Changes in the command definition (adding a return type or changing it) result in hard to read compiler errors which can be discouraging.

The new analyzer will detect these situations:
- Missing return type for a non-void command
- Mismatched return type

And we offer code fixers that fix both scenarios, including rewriting the Execute method to have the correct return type.

Closes #37
@kzu kzu closed this as completed in e287f3e Nov 2, 2022
@kzu kzu added the enhancement New feature or request label Nov 9, 2022
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