StackTrace.AI 1.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package StackTrace.AI --version 1.0.5
                    
NuGet\Install-Package StackTrace.AI -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StackTrace.AI" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StackTrace.AI" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="StackTrace.AI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StackTrace.AI --version 1.0.5
                    
#r "nuget: StackTrace.AI, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package StackTrace.AI@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StackTrace.AI&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=StackTrace.AI&version=1.0.5
                    
Install as a Cake Tool

StackTrace.AI

.NET License AI

Intelligent error analysis for .NET applications


📋 What is StackTrace.AI?

StackTrace.AI automatically captures exceptions in your .NET application, analyzes them using AI (Groq/OpenAI/Gemini), and provides detailed explanations, causes, solutions, and best practices.


✨ Features

Feature Description
🎯 Auto Capture Middleware catches all unhandled exceptions automatically
🤖 AI Analysis Uses Groq, OpenAI, or Gemini to analyze errors
🌐 Bilingual Full support for Arabic (ar) and English (en)
📊 Reports Export to Excel and PDF with complete error analysis
💾 Solution Tracking Mark errors as solved, track recurrence
🎨 Dashboard Interactive dark mode HTML report

🧠 How AI Analysis Works (Prompt Engineering)

StackTrace.AI uses carefully crafted prompts to ensure high-quality, consistent AI responses. Each error analysis follows a structured approach:

System Prompt (English)

You are a senior .NET and C# expert with 10 years of experience.
Analyze errors precisely and provide actionable solutions.

Important instructions:
1. Response must be ONLY JSON, no text before or after
2. Use clear, professional English
3. Provide detailed explanation of the problem and root cause
4. Possible causes must be accurate and specific
5. Solution steps must be sequential and applicable
6. Best practices tips should provide real value

System Prompt (Arabic)

أنت خبير متخصص في .NET و C# مع خبرة 10 سنوات. 
تحليل الأخطاء بدقة وتقديم حلول عملية قابلة للتنفيذ فوراً.

تعليمات مهمة:
1. يجب أن يكون الرد JSON فقط بدون أي كلام قبله أو بعده
2. استخدم لغة عربية فصحى واضحة
3. قدم شرحاً مفصلاً للمشكلة وجذرها
4. الأسباب المحتملة يجب أن تكون دقيقة ومحددة
5. خطوات الحل يجب أن تكون متسلسلة وقابلة للتطبيق
6. نصائح أفضل الممارسات يجب أن تكون ذات قيمة حقيقية

AI Output Format

The AI always returns a consistent JSON structure:

{
    "error_type": "NullReferenceException",
    "explanation": "Detailed explanation of what caused the error...",
    "possible_causes": ["Cause 1", "Cause 2"],
    "solution_steps": ["Step 1", "Step 2"],
    "best_practices": ["Tip 1", "Tip 2"]
}

Why This Matters

Principle How It's Applied
Role Definition "Senior .NET expert with 10 years experience" ensures expert-level responses
Output Format JSON-only responses enable reliable parsing and consistent display
Language Consistency Separate Arabic and English prompts maintain quality in both languages
Structured Information Fixed schema (causes, steps, practices) makes solutions easy to follow
Actionable Guidance Emphasis on practical, implementable solutions
Context Awareness Includes exception type, stack trace, project type, and affected code

This prompt engineering approach ensures every error analysis is:

  • Consistent — Same structure every time
  • Actionable — Clear steps you can implement immediately
  • Educational — Learn best practices with each error
  • Bilingual — High quality in both Arabic and English

🚀 Quick Start

1. Install the Package

dotnet add package StackTrace.AI

2. Configure in Program.cs

using StackTraceAI;

var builder = WebApplication.CreateBuilder(args);

// Add StackTrace.AI services
builder.Services.AddStackTraceAI(builder.Configuration);

var app = builder.Build();

// Use StackTrace.AI middleware
app.UseStackTraceAI();

app.Run();

3. Set API Key

Add your API key to appsettings.json:

{
  "DefaultLanguage": "ar",
  "AI": {
    "DefaultModel": "groq"
  },
  "Groq": {
    "ApiKey": "your-groq-key-here"
  }
}

4. Test

# Create a test error
curl -X GET https://localhost:5001/api/errors/test-error/null

# Open interactive dashboard
open https://localhost:5001/api/report/dashboard-url

📚 API Endpoints

Method Endpoint Description
GET /api/errors Get all captured errors
POST /api/errors/explain Analyze an error
POST /api/errors/solve/{id} Mark error as solved
GET /api/report/dashboard-url Interactive dashboard URL
GET /api/report/excel Export to Excel
GET /api/report/pdf Export to PDF
POST /api/settings/language/{lang} Set language (ar/en)
POST /api/settings/api-key/{provider} Set API key

🤖 Supported AI Models

Model Cost Speed Arabic Support
Groq (LLaMA 3.3) Free ⚡ Very Fast ✅ Excellent
OpenAI (GPT-3.5) Paid 🐢 Moderate ✅ Excellent
Google Gemini Free ⚡ Fast ✅ Good

📄 License

MIT License


Made with curiosity and love — to help every .NET developer build better software

Report BugRequest Feature

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.6 88 3/24/2026
1.0.5 83 3/24/2026
1.0.4 86 3/24/2026
1.0.3 79 3/24/2026
1.0.2 78 3/24/2026
1.0.1 81 3/24/2026
1.0.0 83 3/24/2026