How to discover multi threading related bugs and debug them?

Multi threaded applications are great, they provide high performance, high throughput but tackling concurrency issues are sometimes  not easy. Especially preemption related bug cannot be easily reproduced. Thus Microsoft created a useful tool called CHESS, to simulate all possible preemptions for your multi threaded application.

How to correctly implement multi-threading in C#

Tools And Techniques to Identify Concurrency Issues


Custom Trace Listener and multiple threads


CHESS: Systematic Concurrency Testing

CHESS is a tool for systematic and disciplined concurrency testing. Given a concurrent test, CHESS systematically enumerates the possible thread schedules to find hard-to-find concurrency errors, including assertion violations, deadlocks, data-races, and atomicity violations.

CHESS: An Automated Concurrency Testing Tool

CHESS: Find and Reproduce Heisenbugs in Concurrent Programs

CHESS: An Automated Concurrency Testing Tool



Unit Testing Asynchronous Code: Three Solutions for Better Tests

Improved Multithreaded Unit Testing