# Dispatchers.Unconfined and why you actually want EmptyCoroutineContext

DevFeed: [Dispatchers.Unconfined and why you actually want EmptyCoroutineContext](<https://devfeed.tech/articles/dispatchers-unconfined-and-why-you-actually-want-emptycoroutinecontext-29008.md>)

Original publisher: [Read original article](<https://code.cash.app/dispatchers-unconfined>)

Author: Colin White

Published: 2025-01-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [Cash App Code Blog](<https://devfeed.tech/sources/cash-app-code-blog.md>)

Topics: [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>)

Tags: [coroutine](<https://devfeed.tech/tags/coroutine.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [dispatcher](<https://devfeed.tech/tags/dispatcher.md>), [io](<https://devfeed.tech/tags/io.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

The article explains why Dispatchers.Unconfined can introduce subtle threading bugs and crashes by avoiding thread dispatching. It recommends using EmptyCoroutineContext when injecting dispatchers, allowing synchronous tests while preserving correct dispatching when coroutine contexts change.

## Source excerpt

Use EmptyCoroutineContext instead of Dispatchers.Unconfined.