Skip to content

Commit

Permalink
Serialize payload as JSON in single event view
Browse files Browse the repository at this point in the history
  • Loading branch information
verdie-g committed May 15, 2024
1 parent 56ad8be commit f9fa195
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions DotnetEventsViewer/Components/EventDialogContent.razor
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@using System.Text.Json
@using EventPipe

@implements IDialogContentComponent<Event>
Expand All @@ -16,29 +17,31 @@
</p>
@if (Content.Payload.Count != 0)
{
<ul>
@foreach (var field in Content.Payload)
{
<li>@field.Key: @field.Value</li>
}
</ul>
<pre>
<code>@JsonSerializer.Serialize(Content.Payload, SerializerOptions)</code>
</pre>
}
@if (Content.StackTrace.Frames.Length != 0)
{
<p>Stack Trace:</p>
<pre>
<code>
@foreach (var frame in Content.StackTrace.Frames)
{
@:0x@(frame.Address.ToString("X")) @(frame.ToString())@(Environment.NewLine)
}
</code>
</pre>
<code>
@foreach (var frame in Content.StackTrace.Frames)
{
@:0x@(frame.Address.ToString("X")) @(frame.ToString())@(Environment.NewLine)
}
</code>
</pre>
}
</FluentDialogBody>

@code
{
private static readonly JsonSerializerOptions SerializerOptions = new()
{
WriteIndented = true,
};

[Parameter]
public Event Content { get; set; } = null!;
}

0 comments on commit f9fa195

Please sign in to comment.