diff --git a/dotnet/src/Generated/SessionEvents.cs b/dotnet/src/Generated/SessionEvents.cs index 6648bd18..6dbfa894 100644 --- a/dotnet/src/Generated/SessionEvents.cs +++ b/dotnet/src/Generated/SessionEvents.cs @@ -5,6 +5,7 @@ // AUTO-GENERATED FILE - DO NOT EDIT // Generated from: session-events.schema.json +using System.Diagnostics; using System.Text.Json; using System.Text.Json.Serialization; @@ -13,6 +14,7 @@ namespace GitHub.Copilot.SDK; /// /// Provides the base class from which all session events derive. /// +[DebuggerDisplay("{DebuggerDisplay,nq}")] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FailSerialization)] @@ -107,6 +109,9 @@ public static SessionEvent FromJson(string json) => /// Serializes this event to a JSON string. public string ToJson() => JsonSerializer.Serialize(this, SessionEventsJsonContext.Default.SessionEvent); + + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private string DebuggerDisplay => ToJson(); } /// Represents the session.start event. diff --git a/scripts/codegen/csharp.ts b/scripts/codegen/csharp.ts index e667c28a..3aeb0eef 100644 --- a/scripts/codegen/csharp.ts +++ b/scripts/codegen/csharp.ts @@ -509,6 +509,7 @@ function generateSessionEventsCode(schema: JSONSchema7): string { // AUTO-GENERATED FILE - DO NOT EDIT // Generated from: session-events.schema.json +using System.Diagnostics; using System.Text.Json; using System.Text.Json.Serialization; @@ -519,6 +520,7 @@ namespace GitHub.Copilot.SDK; lines.push(`/// `); lines.push(`/// Provides the base class from which all session events derive.`); lines.push(`/// `); + lines.push(`[DebuggerDisplay("{DebuggerDisplay,nq}")]`); lines.push(`[JsonPolymorphic(`, ` TypeDiscriminatorPropertyName = "type",`, ` UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FailSerialization)]`); for (const variant of [...variants].sort((a, b) => a.typeName.localeCompare(b.typeName))) { lines.push(`[JsonDerivedType(typeof(${variant.className}), "${variant.typeName}")]`); @@ -537,7 +539,9 @@ namespace GitHub.Copilot.SDK; lines.push(` /// Deserializes a JSON string into a .`); lines.push(` public static SessionEvent FromJson(string json) =>`, ` JsonSerializer.Deserialize(json, SessionEventsJsonContext.Default.SessionEvent)!;`, ""); lines.push(` /// Serializes this event to a JSON string.`); - lines.push(` public string ToJson() =>`, ` JsonSerializer.Serialize(this, SessionEventsJsonContext.Default.SessionEvent);`, `}`, ""); + lines.push(` public string ToJson() =>`, ` JsonSerializer.Serialize(this, SessionEventsJsonContext.Default.SessionEvent);`, ""); + lines.push(` [DebuggerBrowsable(DebuggerBrowsableState.Never)]`, ` private string DebuggerDisplay => ToJson();`); + lines.push(`}`, ""); // Event classes with XML docs for (const variant of variants) {