Claude SDK for C# 12.45.0

Last reviewed Sep 20, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. C# 14106 lines · 4.4K tokens
  2. Claude SDK for C# 12.45.0102 lines · 5.1K tokens
Total208 lines · 9.4K tokens

CWE Coverage

  • 20
  • 22
  • 59
  • 78
  • 89
  • 94
  • 117
  • 190
  • 201
  • 208
  • 209
  • 214
  • 257
  • 295
  • 319
  • 323
  • 327
  • 338
  • 347
  • 362
  • 367
  • 378
  • 426
  • 502
  • 532
  • 611
  • 636
  • 639
  • 672
  • 674
  • 732
  • 759
  • 770
  • 772
  • 775
  • 798
  • 807
  • 841
  • 862
  • 863
  • 915
  • 916
  • 918
  • 1333
  • 1395
  • 1426
  • 1427

Prompt Preview

Apply the C# 14 prompt first. These rules cover the official Anthropic NuGet package 12.45.0 with C# 14 on a supported, patched .NET 10 deployment. The package ships net8.0, net9.0, and netstandard2.0 assets; compatibility with those targets does not make C# 14 supported on older runtimes. Apply the MCP-helper rules only when using the separate Anthropic.Mcp package.

Client construction and credentials

  • Keep clients holding reusable API keys, OAuth refresh tokens, or workload identity credentials in trusted server or worker code.
  • Construct production clients with new AnthropicClient(new ClientOptions { ... }), supplying the chosen ApiKey, AuthToken, or Credentials and BaseUrl before construction. Object initializers run after the parameterless constructor has already attempted profile discovery and may have adopted its endpoint and workspace headers.
  • Configure one authentication mechanism and clear unwanted static credentials explicitly. Non-null explicit ApiKey or AuthToken values take priority over Credentials; the static-header path can send both X-Api-Key and Authorization when both options are populated, including from the environment.
  • Audit ambient discovery when it is intentional: ANTHROPIC_API_KEY takes precedence over ANTHROPIC_AUTH_TOKEN, an explicitly selected profile, workload-identity environment variables, and the active disk profile. A null AnthropicCredentials.Resolve result can mean API-key authentication is selected; it does not by itself prove credentials are missing.
  • Fail startup when the expected