neolution-ch / Neolution.CodeAnalysis

Code analyzers and rulesets used for Neolution projects
MIT License
1 stars 2 forks source link

Consider adding Microsoft.VisualStudio.Threading.Analyzers #24

Open neoscie opened 4 months ago

neoscie commented 4 months ago

It's a "code analyzer to detect common mistakes or potential issues regarding threading and async coding.".

it would introduce new rules: https://github.com/microsoft/vs-threading/blob/main/doc/analyzers/index.md

Nuget: https://www.nuget.org/packages/microsoft.visualstudio.threading.analyzers

drebrez commented 4 months ago

Please ensure that a warning/error appears for this example case image

In my opinion this should be avoided in 99.9% of the cases as it might lead to unwanted behavior. If someone want to actually spawn threads in a loop without waiting for them to finish/fail, then they should simply suppress the rule at that point.

It might be the VSTHRD100 rule but I didn't tested it.