microsoft/agents/agents-sdk-dotnet-debugging
Claude Code and agent skill by microsoft/agents
- vendor
Checking that the SKILL.md file is still in the repository.
Use when troubleshooting an agent built with the Microsoft Agents SDK (Microsoft.Agents.Hosting.AspNetCore and related packages) in C# / .NET. Trigger on any of these symptoms: build or C# compile errors, crashes on startup, 401 or auth errors on incoming requests, the bot not responding to messages, appsettings.json configuration problems, Azure AD credential failures (AADSTS errors), port conflicts, or the agent not connecting in Teams or the Agents Playground. Use even if the user doesn't mention the SDK by name — trigger on symptoms like "my bot won't start", "getting 401s", or "bot isn't responding."
Install
npx vskill@latest install microsoft/agents/agents-sdk-dotnet-debuggingSKILL.md
The same SKILL.md was published earlier as microsoft/agents/agents-sdk-dotnet-debugging.
Debugging Agents Built with Microsoft Agents SDK (.NET)
Overview
Most agent failures fall into one of three categories: the code doesn't build or start, the configuration is wrong, or the agent isn't reachable. Work through this checklist in order — each step confirms a prerequisite for the next.
Checklist
You MUST create a task for each of these items and complete them in order:
- Make sure the code builds successfully.
- Make sure the application starts and runs without crashing.
- Make sure the application opens a port and listens for incoming requests.
- Validate the
appsettings.jsonconfiguration. - Validate the bot's credentials against Azure AD.
- Use the Agents Playground to test the agent end-to-end locally.
1. Build the code
Expected: exits with code 0, no errors. Fix any C# compile errors before continuing.
Common build errors:
- Missing package —
dotnet add package Microsoft.Agents.Hosting.AspNetCore - Namespace not found — wrong
usingstatement; see theagents-sdk-dotnetskill for correct namespaces - Target framework mismatch — Agents SDK requires .NET 8+; check
<TargetFramework>in.csproj
2. Start the application
Run with detailed logging:
Or with verbose logging:
To enable debug-level SDK logging, add to appsettings.Development.json:
Watch for crash output. Common startup errors:
- `Unable to resolve service for type 'IStorage'` — missing
builder.Services.AddSingleton<IStorage, MemoryStorage>()inProgram.cs - `AddAgentAspNetAuthentication` missing — add
builder.Services.AddAgentAspNetAuthentication(builder.Configuration) - Port already in use — another process is on the port; check with
netstat -ano | findstr :3978(Windows) orlsof -i :3978(macOS/Linux) - `InvalidOperationException` on startup — check
appsettings.jsonstructure, especiallyConnectionsandConnectionsMap
If the agent starts cleanly, you should see output like:
3. Confirm the agent is reachable
| Response | Meaning | |
|---|---|---|
401 | Agent is running, auth is active — this is correct for a configured agent | |
200 | Agent is running with auth disabled (TokenValidation:Enabled = false) — correct for local dev | |
000 or connection refused | Agent is not running, wrong port, or crashed on startup |
4. Validate appsettings.json configuration
Configuration mistakes are the most common source of failures. Check each area below.
4a. Confirm the file is being loaded
ASP.NET Core auto-loads appsettings.json and appsettings.{Environment}.json. Check that:
- The file exists in the project root
- It has
"Copy to Output Directory": "PreserveNewest"in.csprojor is at the content root ASPNETCORE_ENVIRONMENTis set correctly (Developmentfor local dev)
4b. Check the Connections section structure
The SDK requires a specific JSON structure. Common mistakes:
4c. Check ConnectionsMap
If ConnectionsMap is present, it must be a JSON array with proper structure:
If omitted, the SDK defaults to mapping * to the first connection.
4d. Check TokenValidation section
Audiencesmust include yourClientIdTenantIdmust match the tenant where the app registration lives- Set
Enabled: falsefor anonymous local development
4e. Check OAuth handler configuration
If your agent uses user sign-in, verify the AgentApplication:UserAuthorization section:
The handler key (graph) must match the autoSignInHandlers used in route registration. A mismatch causes the sign-in flow to fail silently.
5. Validate bot credentials against Azure AD
Once appsettings.json looks correct, confirm the credentials actually work:
A successful response includes access_token. Common errors:
| Error code | Cause | |
|---|---|---|
AADSTS700016 | ClientId not found in tenant — wrong ID or wrong tenant | |
AADSTS7000215 | Invalid ClientSecret — expired or incorrect | |
AADSTS90002 | TenantId not found |
6. Test with Agents Playground
The Agents Playground acts as a mock connector and channel client.
Install:
Run against an anonymous agent:
Start your agent:
In a separate terminal:
Run against an authenticated agent:
Channel options (-c): msteams, webchat, directline, emulator, agents
If the playground connects but messages don't get responses, the agent is running but a message handler may be missing. Add a fallback handler to confirm:
Common Runtime Errors
| Error | Cause | Fix | |
|---|---|---|---|
Unable to resolve service for type 'IStorage' | Missing storage registration | Add builder.Services.AddSingleton<IStorage, MemoryStorage>() | |
MapAgentApplicationEndpoints 404 | Using MapAgentEndpoints (compat) with AgentApplication | Switch to MapAgentApplicationEndpoints | |
MapAgentEndpoints 404 | Using MapAgentApplicationEndpoints with ActivityHandler | Switch to MapAgentEndpoints | |
InvalidOperationException: No agent registered | Missing builder.AddAgent<T>() | Add builder.AddAgent<MyAgent>() | |
| 401 on every request | TokenValidation:Enabled is true with no/wrong credentials | Set to false for local dev, or fix credentials | |
System.Text.Json.JsonException on card deserialization | Wrong JSON structure in card content | Validate card JSON separately | |
| OAuth sign-in card appears but token exchange fails | Wrong AzureBotOAuthConnectionName | Verify the connection name matches Azure Bot resource OAuth settings | |
| Streaming chunks not appearing | Missing EndStreamAsync call | Always call await ctx.StreamingResponse.EndStreamAsync(ct) in a finally block |
Validate an OAuth connection name
OAuth connection names can only be tested end-to-end through a real sign-in flow:
Azure Portal → Your Bot Resource → Settings → OAuth Connection Settings → [your connection] → Test Connection
This confirms the connection name matches, the OAuth app has the right scopes, and the redirect URI (https://token.botframework.com/.auth/web/redirect) is registered on the app registration.
Contributing
If you hit a problem this skill couldn't solve, found a workaround, or noticed something wrong or outdated, that's valuable — please help improve this skill for everyone.
Draft a suggested issue title and body based on the conversation, then ask the user to open it at: https://github.com/microsoft/agents/issues/new
A good issue includes:
- What the user was trying to do
- What went wrong (errors, unexpected behavior)
- What worked — including any workaround found during this conversation
- Relevant code or config snippets
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 11 Jun 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent-plugins/agents-for-net/skills/agents-sdk-dotnet-debugging/SKILL.md
Popularity
- Repository stars
- 1,003
- Repository forks
- 323
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Jul 2026, 4 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/agents/agents-sdk-dotnet-debugging)