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

Disable warning for no awaits in async method #175

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ivarne
Copy link
Member

@ivarne ivarne commented Mar 29, 2023

The warning CS1988 is confusing when you implement an interface that requires a Task return value as in IDataProcessor. The message and suggestion to make the method synchronous or use await Task.Run(...) is just plain wrong (for the case when you implement an interface that requires a Task return value).

image

The solution typically is to write await Task.CompletedTask; just to "await something" to ignore the warning, or remove the async keyword and return Task.FromResult(true). None of these "solutions" to the warning is actually improves performance or readability.

This PR proposes to disable this warning for apps, so that app developers can have warning free apps and consistent code whether they call an async api in their events or not.

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

@ivarne ivarne requested a review from tjololo November 15, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant