Add DebuggerDisplay to SessionEvent for better debugging#726
Add DebuggerDisplay to SessionEvent for better debugging#726stephentoub wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a .NET debugging convenience to the generated SessionEvent model so developers can quickly inspect session events as JSON in the debugger, aligning with the SDK’s generated-model workflow.
Changes:
- Update the C# session-events code generator to emit
using System.Diagnostics;and a[DebuggerDisplay]attribute onSessionEvent. - Add a hidden
DebuggerDisplayproperty that returnsToJson()for debugger visualization. - Regenerate
dotnet/src/Generated/SessionEvents.csto reflect the new attribute/property.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| scripts/codegen/csharp.ts | Emits DebuggerDisplay/DebuggerBrowsable annotations and required System.Diagnostics using for generated session-event models. |
| dotnet/src/Generated/SessionEvents.cs | Regenerated output: SessionEvent now shows JSON via debugger display and hides the helper property from property lists. |
Cross-SDK Consistency ReviewThis PR adds a AnalysisThis is a language-specific developer experience enhancement that leverages .NET's debugging infrastructure. While this is a valuable improvement for .NET developers, similar debugging enhancements could be considered for other language SDKs to maintain feature parity in developer experience: PythonThe Python SDK uses def __repr__(self) -> str:
import json
return json.dumps(self.to_dict(), default=str)This would need to be added to the Python code generator ( GoThe Go SDK has a func (r SessionEvent) String() string {
b, _ := r.Marshal()
return string(b)
}This would need to be added to the Go code generator ( TypeScript/Node.jsThe TypeScript SDK uses union types for RecommendationThis PR is good to merge as-is since it's a valid .NET-specific enhancement. However, I suggest considering follow-up issues to add equivalent debugging enhancements to the other SDKs for consistency in developer experience:
These enhancements would ensure all SDK users get a similarly great debugging experience regardless of their language choice. Summary: ✅ No blocking consistency issues. This is a language-appropriate enhancement. Consider adding similar debugging aids to other SDKs in future work.
|
Added [DebuggerDisplay] attribute to SessionEvent base class to show JSON in debugger views.
dbcedb5 to
b660bc6
Compare
✅ Cross-SDK Consistency Review: No Issues FoundI've reviewed this PR for consistency across all four SDK implementations (Node.js/TypeScript, Python, Go, and .NET). SummaryThis PR adds a .NET-specific debugging enhancement using the
RecommendationApprove this PR. The debugging enhancement is language-appropriate and maintains the SDK design principle of following each language's idioms rather than forcing identical implementations across all platforms.
|
Adds
[DebuggerDisplay]to the generatedSessionEventbase class so that hovering over an event in the debugger shows its JSON representation.Changes:
using System.Diagnostics;, the[DebuggerDisplay]attribute, and aDebuggerDisplayproperty on theSessionEventbase class.Before:

After:
