Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Motivation and Context

The [DebuggerDisplay] attribute on AIAgent referenced DisplayName, which was removed in PR #2758. This caused CS0103 compile errors in the debugger visualizer.

Description

Updated [DebuggerDisplay("{DisplayName,nq}")] to [DebuggerDisplay("{Name,nq}")] in AIAgent.cs. The Name property serves the same purpose as a human-readable identifier for debugging.

Changed:

- [DebuggerDisplay("{DisplayName,nq}")]
+ [DebuggerDisplay("{Name,nq}")]
  public abstract class AIAgent
image

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.
Original prompt

This section details on the original issue you should resolve

<issue_title>.NET: [Bug]: Debugger visualizer for AIAgent throws an error</issue_title>
<issue_description>### Description

I have added an AIAgent to the HostBuilder:

builder.Services.AddAIAgent("Default", "You are a helpful assistant");

When I enter debug mode and hover the mouse over an AIAgent variable, the Debugger visualizer for the AIAgent class shows the error CS0103: The name 'DisplayName' does not exist in the current context:

Image

Package Versions

Microsoft.Agents.AI.Hosting: 1.0.0-preview.260108.1, Microsoft.Agents.AI.OpenAI: 1.0.0-preview.260108.1

.NET Version

.NET 10</issue_description>

<agent_instructions>DisplayName property was intentionally removed from the AIAgent in the PR #2758.
Given that I need to fix this issue by updating the attribute [DebuggerDisplay("{DisplayName,nq}")] on the AIAgent class.
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix debugger visualizer error for AIAgent variable Fix DebuggerDisplay attribute to reference existing property Jan 21, 2026
Copilot AI requested a review from rogerbarreto January 21, 2026 10:28
@rogerbarreto rogerbarreto marked this pull request as ready for review January 21, 2026 10:42
Copilot AI review requested due to automatic review settings January 21, 2026 10:42
@github-actions github-actions bot changed the title Fix DebuggerDisplay attribute to reference existing property .NET: Fix DebuggerDisplay attribute to reference existing property Jan 21, 2026
@rogerbarreto rogerbarreto changed the title .NET: Fix DebuggerDisplay attribute to reference existing property .Net: Fix DebuggerDisplay attribute to reference existing property Jan 21, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a debugger visualizer error in the AIAgent class by updating the DebuggerDisplay attribute to reference the existing Name property instead of the removed DisplayName property. The DisplayName property was removed in PR #2758, causing CS0103 compile errors when inspecting AIAgent instances in the debugger.

Changes:

  • Updated DebuggerDisplay attribute from {DisplayName,nq} to {Name,nq} in AIAgent.cs

@rogerbarreto rogerbarreto added this pull request to the merge queue Jan 21, 2026
Merged via the queue into main with commit eac8baa Jan 21, 2026
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: Debugger visualizer for AIAgent throws an error

5 participants