# LibTmux.Server.CaptureSnapshotAsync

- **Module:** LibTmux.Server
- **Package:** LibTmux
- **Language:** .NET
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/6656a563ec9e07ab52e0c3ac96f7704fc94cc0c0/src/LibTmux/Server.Snapshots.cs#L60
- **Page:** https://libtmux.org/reference/dotnet/libtmux-server-capturesnapshotasync/

```
LibTmux.Server.CaptureSnapshotAsync(depth: SnapshotDepth, cancellationToken: CancellationToken) -> Task<Server>
```

Reads the server and answers a handle carrying what it found.

A handle that has not yet found a live server discovers one first,
because a scope hands back the unmaterialized endpoint it started.

## Parameters

- `depth` (SnapshotDepth) — How far down the hierarchy to read.
- `cancellationToken` (CancellationToken) — Cancels the tmux commands.

## Returns

A handle whose relations are the ones this reading found.

## Raises

- `InvalidOperationException` — The handle has no connection.
