# Callback runs in an incompatible scheduler context

Rule ID: concurrency.dispatch-isolation-mismatch@1.0.0. Availability below refers to source-scan at product 524fa07e.

## V-EXEC-04 — Callback runs in an incompatible scheduler context

Callback runs in an incompatible scheduler context. It examines isolation, executor, scheduler, and execution-domain relationships.

### Availability

Selected by default in source-scan. Selection does not mean a supported observation exists in your program.

Use the terminal from [Installation](https://docs.swift-analyzer.com/get-started/installation/), with ANALYZER set. Replace `<package>` and `<product>` with your supported package path and product name.

```text
"$ANALYZER" source-scan --package-path <package> --product <product> --allow-build
```

### Example and action

Illustrative pattern only. This is not a complete runnable package or a reproduced source-scan result. Helper APIs and omitted context must be supplied by the application.

```swift
workerQueue.async {
    legacyView.setNeedsLayout()
}
```

Make the required context explicit at the boundary. Review ordering, lifetime and transferred values before adding a task or changing isolation.

```swift
Task { @MainActor in
    legacyView.setNeedsLayout()
}
```

### Why this check works

The selected execution evaluator compares recognized source/SDK context facts with the condition’s required context. Compare the required execution or isolation context with recognized context transitions and use sites. Actor context, task context and physical thread identity are different facts; suspension alone does not prove a thread hop. The [Swift concurrency guide](https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html) explains the underlying language concepts. Registration establishes selection, not coverage of this illustrative example.

### Assumptions and unknown

The current workflow recognizes bounded source forms. An unresolved required context, callback contract, resource domain or thread-affinity fact can remain unknown. A condition with no supported observations is reported as no-observations, not as proof that all uses are valid.

### Evidence and interpretation

Read condition coverage, observation counts and reasons in the actual report. A finding and an unknown observation can coexist. No observations is not a negative proof.

Historical evidence at 4558458d: recovery-required (historical qualification is incomplete and needs further evidence). That evidence has not been requalified for this product revision.

[How we validate checks](https://docs.swift-analyzer.com/concepts/validation/) explains the evidence boundary. [Foundations](https://docs.swift-analyzer.com/concepts/foundations/) separates method assumptions from implementation claims.


---

Language: en
Canonical: https://docs.swift-analyzer.com/catalog/concurrency.dispatch-isolation-mismatch/
Product revision: 524fa07e0ae4153c84ac12ae9eb6559df89ec2be
Catalog revision: 4558458d
Documentation digest: 1f17ba58ab08627e0de898f1442067b09e960b48cd5605d6529e9275f8930d68
Channel: pre-prod; maturity: experimental; access: owner-provided checkout.
