# Microsoft.Threading.Tasks.Extensions

**Kind:** Service

**Source:** `Pams/Logic/Pams.Storage/Pams.Storage.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`Microsoft.Threading.Tasks.Extensions` is a NuGet package dependency declared by `Pams.Storage.csproj`. It supplies task-related APIs that `Pams.Storage` can reference for asynchronous storage operations and task-based integration points.

## Diagram

```mermaid
sequenceDiagram
    participant App as Application
    participant Storage as Pams.Storage
    participant Package as Microsoft.Threading.Tasks.Extensions
    participant Runtime as Task Runtime

    App->>Storage: Start asynchronous storage operation
    Storage->>Package: Reference task extension API
    Package->>Runtime: Work with task-based operation
    Runtime-->>Storage: Complete task
    Storage-->>App: Return result or failure
```

## Usage

```ts
import { spawnSync } from "node:child_process";

const restore = spawnSync(
  "dotnet",
  ["restore", "Pams/Logic/Pams.Storage/Pams.Storage.csproj"],
  { stdio: "inherit" }
);

if (restore.error) {
  throw restore.error;
}

const build = spawnSync(
  "dotnet",
  ["build", "Pams/Logic/Pams.Storage/Pams.Storage.csproj"],
  { stdio: "inherit" }
);

if (build.error) {
  throw build.error;
}
```

## AI Coding Instructions

- Keep `Microsoft.Threading.Tasks.Extensions` configured as a dependency of `Pams.Storage.csproj`.
- Restore the project before building or running code that references `Pams.Storage`.
- Treat this package as a .NET dependency; JavaScript and TypeScript code should interact with the built .NET project rather than import the package directly.
- Check asynchronous storage call paths for task completion, cancellation, and exception handling.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (2)

- `Pams.Email` — `Pams/Logic/Pams.Email/Pams.Email.csproj`:1
- `Pams.Storage` — `Pams/Logic/Pams.Storage/Pams.Storage.csproj`:1
