Skip to content

Commit

Permalink
always send all thread traces
Browse files Browse the repository at this point in the history
  • Loading branch information
foglio1024 committed Dec 11, 2023
1 parent a37e2df commit 1977e12
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions TCC.Core/Utilities/ExceptionReportBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ public static JObject BuildJsonCrashReport(Exception ex)
ret.Add("packet_data", new JValue(ppe.RawData.ToHexString()));
break;

case DeadlockException de:
ret.Add("thread_traces", GetThreadTraces(de));
break;
}
ret.Add("thread_traces", GetThreadTraces());

return ret;
}
Expand Down Expand Up @@ -112,15 +110,18 @@ static string GetStackTraceClrmd(ClrThread runtimeThread)
return sb.ToString();
}

static JArray GetThreadTraces(DeadlockException de)
static JArray GetThreadTraces()
{
using var dataTarget = DataTarget.CreateSnapshotAndAttach(Process.GetCurrentProcess().Id);

var version = dataTarget.ClrVersions[0];
var runtime = version.CreateRuntime();

var ret = new JArray();
var threads = App.RunningDispatchers.Values.Append(App.BaseDispatcher).Where(d => de.ThreadNames.Contains(d.Thread.Name)).Select(d => d.Thread).Append(PacketAnalyzer.AnalysisThread);
var threads = App.RunningDispatchers.Values
.Append(App.BaseDispatcher)
.Select(d => d.Thread)
.Append(PacketAnalyzer.AnalysisThread);
foreach (var thread in threads)
{
if (thread.Name == null) continue;
Expand Down

0 comments on commit 1977e12

Please sign in to comment.