Swevo.PollyAnalyzers 1.0.1

Prefix Reserved
dotnet add package Swevo.PollyAnalyzers --version 1.0.1
                    
NuGet\Install-Package Swevo.PollyAnalyzers -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Swevo.PollyAnalyzers" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Swevo.PollyAnalyzers" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Swevo.PollyAnalyzers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Swevo.PollyAnalyzers --version 1.0.1
                    
#r "nuget: Swevo.PollyAnalyzers, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Swevo.PollyAnalyzers@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Swevo.PollyAnalyzers&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Swevo.PollyAnalyzers&version=1.0.1
                    
Install as a Cake Tool

PollyAnalyzers

NuGet NuGet Downloads CI License: MIT

Free, MIT-licensed Roslyn analyzers for async/resilience anti-patterns. No per-seat license required — ever.

Why PollyAnalyzers?

ReSharper (~$249+/seat/year) and similar commercial tools are broad style/inspection suites. Free tools like Roslynator and SonarLint already cover general C# code smells well. What none of them specifically targets is reliability: the handful of async/exception-handling mistakes that cause deadlocks, silent failures, and un-cancellable requests in production. PollyAnalyzers is a small, focused analyzer pack for exactly that gap, built by the same team that maintains 28+ Polly v8 resilience integration packages.

var data = httpClient.GetAsync(url).Result;              // PLY001: blocking call, deadlock risk
async void OnTimerElapsed(object? state) { ... }          // PLY002: async void, unobservable exceptions
SendWelcomeEmailAsync(order);                             // PLY003: fire-and-forget, exception lost
catch (Exception) { }                                     // PLY004: swallowed exception
await httpClient.GetAsync(url);                           // PLY005: cancellationToken in scope, not passed

Install

dotnet add package Swevo.PollyAnalyzers

Works automatically in Visual Studio, Rider, and VS Code (via the C# Dev Kit/OmniSharp Roslyn workspace) the moment the package is referenced — no separate IDE extension to install.

Rules

ID Severity Title
PLY001 Warning Blocking call on async API (.Result, .Wait(), .GetAwaiter().GetResult()) may cause a deadlock
PLY002 Warning Avoid async void methods (except conventional event handlers)
PLY003 Warning Fire-and-forget task is not awaited, assigned, or discarded
PLY004 Warning Empty catch block swallows exceptions
PLY005 Info Async call drops an available CancellationToken

Each rule ships with one or more code fixes (Ctrl+. / Alt+Enter):

  • PLY001 — replace with await (offered only inside an already-async method, since the fix can't safely make a sync method async and update every caller for you).
  • PLY002 — change the return type to Task.
  • PLY003 — discard with _ = (always safe), or await the call (offered inside async methods).
  • PLY004 — insert throw; to rethrow instead of swallowing.
  • PLY005 — append the in-scope CancellationToken as the call's last argument.

Suppressing a rule

Standard Roslyn suppression applies — per line:

#pragma warning disable PLY001
var data = httpClient.GetAsync(url).Result;
#pragma warning restore PLY001

or per-project via .editorconfig:

dotnet_diagnostic.PLY001.severity = none

Design goals

  • MIT licensed, forever. No commercial tier, no per-seat fees.
  • Narrow and precise. Five rules that catch real production incidents, not hundreds of style opinions — pairs cleanly alongside Roslynator/SonarLint rather than competing with them.
  • Actionable. Every rule ships with a code fix, not just a warning.

Roadmap

  • Additional rules are being considered based on real-world false-positive/false-negative feedback: HttpClient calls with no timeout or retry policy configured, and ConfigureAwait(false) guidance for library code.

💼 Need .NET consulting?

I'm the author of PollyAnalyzers and a suite of compile-time source generators (AutoWire, AutoMap.Generator) and 28+ Polly v8 resilience packages. I'm available for consulting on Polly v8 resilience, Azure cloud architecture, and clean .NET design.

→ solidqualitysolutions.com · LinkedIn

Also by the same author

🌐 Full suite overview: swevo.github.io

Package Description
FluentPdf Free, MIT-licensed fluent PDF generation — alternative to QuestPDF's commercial license.
AutoBus Free, MIT-licensed message bus — alternative to MassTransit's commercial license.
AutoArchitecture Free, MIT-licensed compile-time architecture rule enforcement — alternative to NDepend.
AutoAssert Free, MIT-licensed fluent assertions — alternative to FluentAssertions' commercial license.
AutoWire Compile-time DI auto-registration — [Scoped]/[Singleton]/[Transient] generates IServiceCollection registration code.
PollyAction Free retry/backoff GitHub Action — wrap any CI step with exponential-backoff retries.

License

MIT © Justin Bannister

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 119 7/7/2026
1.0.0 109 7/7/2026

1.0.1: Add missing package icon. 1.0.0: Initial release. PLY001-PLY005 resilience/reliability analyzers with code fixes.