-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[CS1998] This async method lacks 'await' operators and will run synchronously #6513
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
Conversation
@@ -184,7 +184,8 @@ protected override bool ReceivePluginInternal(object message) | |||
|
|||
private async Task<(IEnumerable<string> Ids, int LastOrdering)> SelectAllPersistenceIdsAsync(int offset) | |||
{ | |||
return (new HashSet<string>(_allMessages.Skip(offset).Select(p => p.PersistenceId)), _allMessages.Count); | |||
return await Task.FromResult((new HashSet<string>(_allMessages.Skip(offset).Select(p => p.PersistenceId)), _allMessages.Count)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's talk about this @Aaronontheweb @Arkatufus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove the async
and the await
here - just returning the Task.Result
should be fine.
@@ -207,7 +208,8 @@ private async Task<int> ReplayTaggedMessagesAsync(ReplayTaggedMessages replay) | |||
index++; | |||
} | |||
|
|||
return _tagsToMessagesMapping[replay.Tag].Count - 1; | |||
return await Task.FromResult(_tagsToMessagesMapping[replay.Tag].Count - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's talk about this @Aaronontheweb @Arkatufus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same feedback as above.
@eaba is this ready for review? |
I will tell you @Aaronontheweb |
- `TestPublisher.cs` - `Utils.cs` - `EventFilterApplier.cs` - `BlockingQueue.cs` - `TestKitBase_AwaitConditions.cs` - `TestKitBase_Within.cs`
This is broken |
Changes
"warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread."
Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):
Latest
dev
BenchmarksInclude data from the relevant benchmark prior to this change here.
This PR's Benchmarks
Include data from after this change here.