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).
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
[x] 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)
The warning CS1988 is confusing when you implement an interface that requires a
Task
return value as inIDataProcessor
. The message and suggestion to make the method synchronous or useawait Task.Run(...)
is just plain wrong (for the case when you implement an interface that requires aTask
return value).The solution typically is to write
await Task.CompletedTask;
just to "await something" to ignore the warning, or remove theasync
keyword andreturn 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
Documentation