StackTrace.AI
1.0.2
See the version list below for details.
dotnet add package StackTrace.AI --version 1.0.2
NuGet\Install-Package StackTrace.AI -Version 1.0.2
<PackageReference Include="StackTrace.AI" Version="1.0.2" />
<PackageVersion Include="StackTrace.AI" Version="1.0.2" />
<PackageReference Include="StackTrace.AI" />
paket add StackTrace.AI --version 1.0.2
#r "nuget: StackTrace.AI, 1.0.2"
#:package StackTrace.AI@1.0.2
#addin nuget:?package=StackTrace.AI&version=1.0.2
#tool nuget:?package=StackTrace.AI&version=1.0.2
StackTrace.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 ✨
| Product | Versions 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. |
-
net8.0
- ClosedXML (>= 0.105.0)
- Hangfire (>= 1.8.23)
- Hangfire.Storage.SQLite (>= 0.4.3)
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.3.0)
- Microsoft.EntityFrameworkCore.Sqlite (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.2)
- Microsoft.SemanticKernel (>= 1.74.0)
- Microsoft.SemanticKernel.Connectors.Google (>= 1.74.0-alpha)
- QuestPDF (>= 2026.2.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.