dennisdoomen / CSharpGuidelines

A set of coding guidelines for C# 9.0, design principles and layout rules for improving the overall quality of your code development.
https://www.csharpcodingguidelines.com
Other
746 stars 271 forks source link

Add adjustment for long-running operations in AV1825 #204

Closed rynkevich closed 4 years ago

rynkevich commented 4 years ago

I think that the rule 1825 deserves slight adjustment. If the operation takes too much time to execute, using Task.Run could lead to performance degradation and resource leaks as thread pool threads will be unavailable for a long time. A way to overcome this is to create a new thread, which could be done with Task.Factory.StartNew, an extended version of Task.Run (or the latter is a shortcut for Task.Factory.StartNew if we'd follow it chronologically).

dennisdoomen commented 4 years ago

That's a great suggestion. Thanks for that.