Particular.CodeRules deprecated

We’ve been using Particular.CodeRules package for a while to spot missing ConfigureAwaits in our non-dotnet-core projects for a while. I just noticed that it’s marked as deprecated in nuget.org.

Is there a reason to avoid using the package? Any suggestions on what to use instead?

Hey @koraybalci, we’ve gone in a different direction with that package. We’ve started writing a bunch more analyzers to enforce internal coding standards to the point where you wouldn’t want to use it on a non-Particular project.

But you don’t need our ConfigureAwait analyzer anymore, there’s a built-in analyzer for that, CA2007: Do not directly await a Task, which you’d just need to elevate to warning/error using an editorconfig file.

The other main analyzer we had in there that I think non-staff had started using was the dropped task analyzer, to detect when you fail to properly await a method call that returns a Task. There are now a bunch of libraries that provide this and usually other analyzers that enforce async best practices. This is a good blog post to look at some of those.

Also worth noting, even without one of those other analyzers, the NServiceBus package includes an analyzer that will alert when you don’t await a task from an NServiceBus API like Send, Publish, etc.

1 Like