Install-Package ConcurrencyLab.ParallelChecker -Version 2.4.0
dotnet add package ConcurrencyLab.ParallelChecker --version 2.4.0
<PackageReference Include="ConcurrencyLab.ParallelChecker" Version="2.4.0" />
paket add ConcurrencyLab.ParallelChecker --version 2.4.0
#r "nuget: ConcurrencyLab.ParallelChecker, 2.4.0"
// Install ConcurrencyLab.ParallelChecker as a Cake Addin #addin nuget:?package=ConcurrencyLab.ParallelChecker&version=2.4.0 // Install ConcurrencyLab.ParallelChecker as a Cake Tool #tool nuget:?package=ConcurrencyLab.ParallelChecker&version=2.4.0
The Parallel Checker is a static analysis that detects data races, deadlocks and other concurrency issues in C#. The analysis is available as a NuGet package (e.g. for Visual Studio Code) and as a Visual Studio extension.
Visual Studio Code Integration
- Install the C# extension in Visual Studio Code, if not yet done.
- Menu "File"->"Preferences"->"Extensions"
- Search for "C# for Visual Studio Code (powered by Omnisharp)" and install it.
- Enable Roslyn analyzers in the setting.
- Menu "File"->"Preferences"->"Settings"
- Select "Extensions"->"C# configuration"
- Go to section "Omnisharp: Enable Roslyn Analyzers"
- Enable the option "Enable support for roslyn analyzers, code fixes and rulesets."
- Add the NuGet package "ConcurrencyLab.ParallelChecker" to the desired C# projects.
- Menu "Termin"-"New Terminal"
- Enter "dotnet add package ConcurrencyLab.ParallelChecker"
- Checker issues are displayed in the "problems" view and are also highlighted in the code
- Menu "View"->"Problems"
- If issues do not appear: Close and reopen the C# projects, wait for a moment, optionally run the project
Visual Studio Integration (VS 2022)
- Open Visual Studio
- Menu "Extensions"->"Manage Extensions"
- Search for "Parallel Checker for C# 10 (VS 2022)" and install it
- Close Visual Studio, follow the installer, and restart Visual Studio
More detailed instructions can be found at the VS Marketplace website of latest Parallel Checker.
Support for older VS 2019 is available at VS Marketplace website of Parallel Checker for VS 2019.
The checker detects the following concurrency (multi-threading) issues with a static analysis, however, not necessarily all of them:
- Data Races: Unsynchronized concurrent accesses to same variable or array element, involving at least a write.
- Deadlocks: Constellations in which multiple threads block each other cyclically forever.
- Thread-unsafe usage: Unsynchronized concurrent calls or accesses of application programming interfaces that are not specified to be thread safe.
The abovementioned issues are all fundamental programming bugs that can lead to program errors. These issues occur non-deterministically, possibly sporadically or very seldom. They are therefore hard to identify in tests and are not easily reproducible. For this reason, it makes sense to use a static analysis that examines various program traces, including very specific or seldom cases, as to whether they suffer from such issues.
As a first starting point, you can try the sample C# solutions to detect data races and deadlocks. You can download the samples from https://parallel-checker.com/Samples
How It Works
The checker is implemented based on the compiler framework Roslyn and analyzes the C# source code without executing the program, called static analysis. It screens as many interesting program traces as possible within defined deterministic bounds. The analysis maintains exact and complete context information for the program, where possible. Exceptions are e.g. external input/output and missing or incorrect source code parts, in which case conservative assumptions are made. The properties of the checker can be summarized as:
- Precise: Real issues are reported without false positives (no false alarms), except when making conservative assumptions.
- Incomplete: The checker may miss potential issues (possible false negatives) as there exists no precise and complete analysis.
- Deterministic: The same issues are repeatedly reported for the same program.
The checker engages a new algorithm. It has been designed to efficiently deal with large software projects and find as many issues with high precision as possible.
You can find more information on the checker website https://parallel-checker.com
|.NET||net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows|
|.NET Core||netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1|
|.NET Standard||netstandard2.0 netstandard2.1|
|.NET Framework||net461 net462 net463 net47 net471 net472 net48|
- No dependencies.
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.