---
title: "preconditionIsolated(_:file:line:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/mainactor/preconditionisolated(_:file:line:)"
---

# preconditionIsolated(_:file:line:)

Stops program execution if the current task is not executing on this actor’s serial executor.

## Declaration

```swift
@backDeployed(before: macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0)
nonisolated func preconditionIsolated(_ message: @autoclosure () -> String = String(), file: StaticString = #fileID, line: UInt = #line)
```

## Parameters

- `message`: The message to print if the assertion fails.
- `file`: The file name to print if the assertion fails. The default is where this method was called.
- `line`: The line number to print if the assertion fails The default is where this method was called.

## Discussion

Discussion This function’s effect varies depending on the build flag used: In playgrounds and -Onone builds (the default for Xcode’s Debug configuration), stops program execution in a debuggable state after printing message. In -O builds (the default for Xcode’s Release configuration), stops program execution. note: Because this check is performed against the actor’s serial executor, if another actor uses the same serial executor–by using that actor’s serial executor as its own unownedExecutor–this check will succeed.  From a concurrency safety perspective, the serial executor guarantees mutual exclusion of those two actors.
