Skip to content

Commit

Permalink
Merge pull request #51 from Dynatrace/bugfix-nre-clrexcepion
Browse files Browse the repository at this point in the history
Bugfixes around detecting CLR Stacktraces
  • Loading branch information
discostu105 authored May 4, 2017
2 parents 22fe6c8 + eecab3d commit 81e1569
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 44 deletions.
6 changes: 2 additions & 4 deletions src/SuperDump/ModelHelpers/ModelHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static SDCombinedStackFrame ToSDModel(this ClrStackFrame frame) {
}
}
}
return new SDCombinedStackFrame(type, frame.InstructionPointer, frame.StackPointer, methodName, moduleName, frame.Method.NativeCode);
return new SDCombinedStackFrame(type, frame.InstructionPointer, frame.StackPointer, methodName, moduleName, (frame.Method != null ? frame.Method.NativeCode : 0));
}

public static SDBlockingObject ToSDModel(this BlockingObject obj) {
Expand Down Expand Up @@ -84,12 +84,10 @@ public static SDClrException ToSDModel(this ClrException clrException) {
}

model.Message = clrException.GetExceptionMessageSafe();

var frames = new List<SDCombinedStackFrame>();

foreach (ClrStackFrame clrFrame in clrException.StackTrace) {
model.StackTrace.Add(clrFrame.ToSDModel());
}
model.StackTrace = new SDCombinedStackTrace(frames);
}
return model;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@model SuperDump.Models.SDCombinedStackTrace

<ul>
<ul class="flat">
@foreach (var frame in Model) {
<li>@frame.ModuleName!@frame.Type . @frame.MethodName</li>
<li>@frame.ModuleName!@frame.MethodName</li>
}
</ul>
72 changes: 35 additions & 37 deletions src/SuperDumpService/Views/Home/_Summary.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,45 @@
@if (Model.Result.DeadlockInformation.Count > 0) {
noAnomalies = false;
<h4>Deadlock detection:</h4>
@foreach (var d in Model.Result.DeadlockInformation) {
<p>
Thread
<a href="#@d.lastThreadId" class="thread-link">#@Model.Result.ThreadInformation.Values.Single(x => x.OsId == d.lastThreadId).EngineId</a> waits for Thread
<a href="#@d.lockedOnThreadId" class="thread-link">@d.lockedOnThreadId</a>
</p>
}}
@foreach (var d in Model.Result.DeadlockInformation) {
<p>
Thread
<a href="#@d.lastThreadId" class="thread-link">#@Model.Result.ThreadInformation.Values.Single(x => x.OsId == d.lastThreadId).EngineId</a> waits for Thread
<a href="#@d.lockedOnThreadId" class="thread-link">@d.lockedOnThreadId</a>
</p>
}}
@if (Model.Result.ExceptionRecord.Count > 0) {
noAnomalies = false;
<h4>Exception report:</h4>
<table class="table table-bordered">
<thead>
<tr>
<th>Engine thread ID</th>
<th>Exception Type</th>
<th>Message</th>
<th>Stacktrace</th>
</tr>
</thead>
<tbody>
@foreach (var ex in Model.Result.ExceptionRecord) {
<tr>
<td><a class="thread-link" href="#@ex.OSThreadId">#@Model.Result.ThreadInformation.Values.Single(x => x.OsId == ex.OSThreadId).EngineId</a></td>
<td>@ex.Type</td>
<td>@ex.Message</td>
@if (ex.StackTrace != null && ex.StackTrace.Count > 0) {
<td>
<ul>
@foreach (var f in ex.StackTrace) {
<li>@f.ModuleName!@f.MethodName</li>
}
</ul>
</td>
} else {
<td>Not avaliable</td>
}
</tr>
}
</tbody>
<table class="table table-bordered">
<thead>
<tr>
<th>Engine thread ID</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var ex in Model.Result.ExceptionRecord) {
<tr>
<td><a class="thread-link" href="#@ex.OSThreadId">#@Model.Result.ThreadInformation.Values.Single(x => x.OsId == ex.OSThreadId).EngineId</a></td>
<td>
<p><strong>Type: </strong>@ex.Type</p>
<p><strong>Message: </strong>@ex.Message</p>
<p>
<strong>Stacktrace:</strong>
</p>
@if (ex.StackTrace != null && ex.StackTrace.Count > 0) {

<p>@Html.Partial("_StacktracePlain", @ex.StackTrace)</p>

</table>
} else {
<p>Not avaliable</p>
}
</td>
</tr>
}
</tbody>
</table>
}
@if (noAnomalies) {
<h4>No special anomalies found</h4>
Expand Down
2 changes: 1 addition & 1 deletion src/SuperDumpService/Views/Home/_Threads.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<dt>Exception Message:</dt>
<dd>@thread.LastException.Message</dd>
<dt>Exception Stack:</dt>
<dd>@Html.Partial("StacktracePlain", @thread.LastException.StackTrace)</dd>
<dd>@Html.Partial("_StacktracePlain", @thread.LastException.StackTrace)</dd>
}
</dl>
</td>
Expand Down

0 comments on commit 81e1569

Please sign in to comment.