-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Clean up async timeout extension methods #16620
Comments
Thanks for contacting us. |
This seems like a simple clean up item but also seem like it's of low priority. |
We should replace this with the new built in |
It is itchy to replace [SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Required to maintain compatibility")]
private static async Task TimeoutAfter(this Task task, TimeSpan timeout,
[CallerFilePath] string filePath = null,
[CallerLineNumber] int lineNumber = default) and message created as: private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
=> string.IsNullOrEmpty(filePath)
? $"The operation timed out after reaching the limit of {timeout.TotalMilliseconds}ms."
: $"The operation at {filePath}:{lineNumber} timed out after reaching the limit of {timeout.TotalMilliseconds}ms."; The suggested Can I remove this custom error message with the filePath and lineNumber, or they must stay? |
Hmmm, good point. Maybe we keep the extension methods and replace to implementation and catch the error thrown by WaitAsync and rethrow our own. |
Ok, so my understanding of this project, I am planning to do the following:
Let's see how it goes, my machine is struggling a bit with 8GB RAM and the full solution. 🥵 |
@ladeak If you use |
There are async timeout extension methods available in Microsoft.AspNetCore.Testing, e.g.
await task.TimeoutAfter()
.Many ASP.NET Core projects have there own copies of these timeout methods, or wrap them in there own extension methods (probably done to remove a copy while minimizing changes), e.g. https://github.com/aspnet/AspNetCore/blob/master/src/Hosting/TestHost/test/Utilities.cs
We should go through aspnetcore/extensions and clean up the copies and wrappers.
The text was updated successfully, but these errors were encountered: