Communityコーディング&開発github.com

getsentry/sentry-dotnet-sdk

.NET 向けの完全な Sentry SDK セットアップ。ASP.NET Core、MAUI、WPF、WinForms、Blazor、Azure Functions、その他の .NET アプリケーションにエラーモニタリング、トレーシング、プロファイリング、ロギング、または Cron を設定する際に使用します。

sentry-dotnet-sdk とは?

このスキルは、.NET アプリケーションに Sentry SDK をインストールし、エラーモニタリング、トレーシング、プロファイリング、ロギング、Cron モニタリングを完全に設定するためのものです。ASP.NET Core、MAUI、WPF、WinForms、Blazor、Azure Functions など、幅広い .NET フレームワークとテクノロジーをサポートしています。ユーザーが「Sentry を .NET に追加」「C# で Sentry をインストール」などと依頼した際に、適切な NuGet パッケージの追加と初期化コードの生成を行います。このスキールは、Sentry の公式ドキュメントに基づいており、エラーレポート、パフォーマンストレーシング、ユーザーフィードバック、リリース管理などを、最小限の手順で統合できます。また、環境変数やアプリ設定を通じて DSN(データソース名)を構成し、非同期処理、サードパーティライブラリとの互換性、フィルタリングやサンプリングの設定など、高度なカスタマイズにも対応します。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/getsentry/sentry-for-ai/tree/main/skills/sentry-dotnet-sdk

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

sentry-dotnet-sdk は何をしますか?

.NET 向けの完全な Sentry SDK セットアップ。ASP.NET Core、MAUI、WPF、WinForms、Blazor、Azure Functions、その他の .NET アプリケーションにエラーモニタリング、トレーシング、プロファイリング、ロギング、または Cron を設定する際に使用します。「Sentry を .NET に追加」「C# で Sentry をインストール」などと依頼されたときに使用します。

使用方法

  1. NuGet パッケージのインストール:

    dotnet add package Sentry
    

    特定のフレームワーク向けの追加パッケージ:

    • ASP.NET Core: Sentry.AspNetCore
    • MAUI: Sentry.Maui
    • WPF/WinForms: Sentry (基本パッケージ)
    • Blazor: Sentry.AspNetCore
    • Azure Functions: Sentry.AzureFunctions.Worker
  2. DSN の設定: 環境変数 SENTRY_DSN を設定するか、以下のようにコード内で直接設定します:

    using Sentry;
    
    SentrySdk.Init(options =>
    {
        options.Dsn = "https://[email protected]/0";
        // プロダクションでは環境変数から取得
        // options.Dsn = Environment.GetEnvironmentVariable("SENTRY_DSN");
    });
    
  3. ASP.NET Core でのセットアップ: Program.cs に以下を追加:

    builder.WebHost.UseSentry();
    
    // オプションで設定を構成
    builder.WebHost.UseSentry(options =>
    {
        options.Dsn = "https://[email protected]/0";
        options.TracesSampleRate = 0.1; // トレーシングのサンプルレート (10%)
        options.ProfilesSampleRate = 0.1; // プロファイリングのサンプルレート (10%)
    });
    
  4. 手動でのエラーキャプチャ:

    using Sentry;
    
    try
    {
        // 処理
    }
    catch (Exception ex)
    {
        SentrySdk.CaptureException(ex);
    }
    
  5. トレーシングの設定:

    // ASP.NET Core では自動トレーシング
    // 手動トランザクション:
    var transaction = SentrySdk.StartTransaction(
        "operation", "my-transaction"
    );
    var span = transaction.StartChild("sub-operation");
    // ... 処理
    span.Finish();
    transaction.Finish();
    
  6. ロギングの統合: appsettings.json:

    {
      "Sentry": {
        "Dsn": "https://[email protected]/0",
        "MinimumEventLevel": "Warning",
        "MinimumBreadcrumbLevel": "Information"
      }
    }
    
  7. ユーザーフィードバック:

    SentrySdk.CaptureUserFeedback(
        eventId,
        "[email protected]",
        "What happened?",
        "User Name"
    );
    

対応プラットフォーム

  • ASP.NET Core 2.0+ / 3.0+ / 5.0+ / 6.0+ / 7.0+ / 8.0+
  • .NET MAUI
  • WPF (.NET Core/5+ / .NET Framework 4.6.1+)
  • WinForms (.NET Core/5+ / .NET Framework 4.6.1+)
  • Blazor Server / WebAssembly
  • Azure Functions (Isolated Worker)
  • Console / サービスアプリケーション
  • Xamarin.Forms (レガシー)
  • Unity (実験的)

注意点

  • DSN は機密情報です。ソース管理にはコミットしないでください。環境変数または安全な構成ストアを使用してください。
  • SentrySdk.Init はアプリケーションの起動時に一度だけ呼び出します。
  • プロファイリングは .NET 6 以降で利用可能です。
  • Cron モニタリング (Check-in) は SentrySdk.CaptureCheckIn を使用します。

参考リンク

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

getsentry/sentry-android-sdk

Full Sentry SDK setup for Android. Use when asked to "add Sentry to Android", "install sentry-android", "setup Sentry in Android", or configure error monitoring, tracing, profiling, session replay, or logging for Android applications. Supports Kotlin and Java codebases.

getsentry/sentry-browser-sdk

Full Sentry SDK setup for browser JavaScript. Use when asked to "add Sentry to a website", "install @sentry/browser", or configure error monitoring, tracing, session replay, or logging for vanilla JavaScript, jQuery, static sites, or WordPress.

getsentry/sentry-cloudflare-sdk

Full Sentry SDK setup for Cloudflare Workers and Pages. Use when asked to "add Sentry to Cloudflare Workers", "install @sentry/cloudflare", or configure error monitoring, tracing, logging, crons, or AI monitoring for Cloudflare Workers, Pages, Durable Objects, Queues, Workflows, or Hono on Cloudflare.

getsentry/sentry-cocoa-sdk

Full Sentry SDK setup for Apple platforms (iOS, macOS, tvOS, watchOS, visionOS). Use when asked to "add Sentry to iOS", "add Sentry to Swift", "install sentry-cocoa", or configure error monitoring, tracing, profiling, session replay, logging, or metrics for Apple applications. Supports SwiftUI and UIKit.

getsentry/sentry-code-review

Analyze and resolve Sentry comments on GitHub Pull Requests. Use this when asked to review or fix issues identified by Sentry in PR comments. Can review specific PRs by number or automatically find recent PRs with Sentry feedback.

getsentry/sentry-create-alert

Create Sentry alerts using the workflow engine API. Use when asked to create alerts, set up notifications, configure issue priority alerts, or build workflow automations. Supports email, Slack, PagerDuty, Discord, and other notification actions.

getsentry/sentry-elixir-sdk

Full Sentry SDK setup for Elixir. Use when asked to "add Sentry to Elixir", "install sentry for Elixir", or configure error monitoring, tracing, logging, or crons for Elixir, Phoenix, or Plug applications. Supports Phoenix, Plug, LiveView, Oban, and Quantum.

getsentry/sentry-feature-setup

Configure specific Sentry features beyond basic SDK setup. Use when asked to monitor AI/LLM calls, set up OpenTelemetry pipelines, create alerts and notifications, or enable span streaming.

getsentry/sentry-fix-issues

Find and fix issues from Sentry using MCP. Use when asked to fix Sentry errors, debug production issues, investigate exceptions, or resolve bugs reported in Sentry. Methodically analyzes stack traces, breadcrumbs, traces, and context to identify root causes.

getsentry/sentry-flutter-sdk

Full Sentry SDK setup for Flutter and Dart. Use when asked to "add Sentry to Flutter", "install sentry_flutter", "setup Sentry in Dart", or configure error monitoring, tracing, profiling, session replay, or logging for Flutter applications. Supports Android, iOS, macOS, Linux, Windows, and Web.

getsentry/sentry-go-sdk

Full Sentry SDK setup for Go. Use when asked to "add Sentry to Go", "install sentry-go", "setup Sentry in Go", or configure error monitoring, tracing, logging, metrics, or crons for Go applications. Supports net/http, Gin, Echo, Fiber, FastHTTP, Iris, Negroni, and gRPC.

getsentry/sentry-nestjs-sdk

Full Sentry SDK setup for NestJS. Use when asked to "add Sentry to NestJS", "install @sentry/nestjs", "setup Sentry in NestJS", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for NestJS applications. Supports Express and Fastify adapters, GraphQL, microservices, WebSockets, and background jobs.

getsentry/sentry-nextjs-sdk

Full Sentry SDK setup for Next.js. Use when asked to "add Sentry to Next.js", "install @sentry/nextjs", or configure error monitoring, tracing, session replay, logging, profiling, AI monitoring, or crons for Next.js applications. Supports Next.js 13+ with App Router and Pages Router.

getsentry/sentry-node-sdk

Full Sentry SDK setup for Node.js, Bun, and Deno. Use when asked to "add Sentry to Node.js", "add Sentry to Bun", "add Sentry to Deno", "install @sentry/node", "@sentry/bun", or "@sentry/deno", or configure error monitoring, tracing, logging, profiling, metrics, crons, or AI monitoring for server-side JavaScript/TypeScript runtimes.

getsentry/sentry-otel-exporter-setup

Configure the OpenTelemetry Collector with Sentry Exporter for multi-project routing and automatic project creation. Use when setting up OTel with Sentry, configuring collector pipelines for traces and logs, or routing telemetry from multiple services to Sentry projects.

getsentry/sentry-php-sdk

Full Sentry SDK setup for PHP. Use when asked to "add Sentry to PHP", "install sentry/sentry", "setup Sentry in PHP", or configure error monitoring, tracing, profiling, logging, metrics, or crons for PHP applications. Supports plain PHP, Laravel, and Symfony.

getsentry/sentry-pr-code-review

Review a project's PRs to check for issues detected in code review by Seer Bug Prediction. Use when asked to review or fix issues identified by Sentry in PR comments, or to find recent PRs with Sentry feedback.

getsentry/sentry-python-sdk

Full Sentry SDK setup for Python. Use when asked to "add Sentry to Python", "install sentry-sdk", "setup Sentry in Python", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for Python applications. Supports Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado, and more.

getsentry/sentry-react-native-sdk

Full Sentry SDK setup for React Native and Expo. Use when asked to "add Sentry to React Native", "install @sentry/react-native", "setup Sentry in Expo", or configure error monitoring, tracing, profiling, session replay, or logging for React Native applications. Supports Expo managed, Expo bare, and vanilla React Native.

getsentry/sentry-react-sdk

Full Sentry SDK setup for React. Use when asked to "add Sentry to React", "install @sentry/react", or configure error monitoring, tracing, session replay, profiling, or logging for React applications. Supports React 16+, React Router v5-v7 non-framework mode, TanStack Router, Redux, Vite, and webpack.

関連スキル