Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Apr 11, 2024
1 parent cff7b9e commit 4bfc076
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
38 changes: 22 additions & 16 deletions src/BUTR.CrashReport.Renderer.Html/CrashReportHtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,47 +222,53 @@ private static void AddInvolvedModules(CrashReportModel crashReport, StringBuild
{
foreach (var involvedModule in crashReport.InvolvedModules.GroupBy(x => x.ModuleOrLoaderPluginId))
{
sbMain.Append("<li>")
.Append("Module Id: ").Append("<b><a href='javascript:;' onclick='scrollToElement(\"").Append(involvedModule.Key).Append("\")'>").Append(involvedModule.Key).Append("</a></b>").Append("<br/>")
.Append("<ul>");
sbMain.Append("<li>");
sbMain.Append("Module Id: ").Append("<b><a href='javascript:;' onclick='scrollToElement(\"").Append(involvedModule.Key).Append("\")'>").Append(involvedModule.Key).Append("</a></b>");

sbMain.Append("<ul>");
foreach (var involved in involvedModule)
{
sbMain.Append("<li>");
sbMain.Append("Frame: ").Append(involved.EnhancedStacktraceFrameName.EscapeGenerics());
sbMain.Append("</li>");
}
sbMain.Append("/<ul>");

sbMain.Append("</li>");
}
}
private static void AddInvolvedPlugins(CrashReportModel crashReport, StringBuilder sbMain)
{
foreach (var involvedPlugin in crashReport.InvolvedLoaderPlugins.GroupBy(x => x.ModuleOrLoaderPluginId))
{
sbMain.Append("<li>")
.Append("Plugin Id: ").Append("<b><a href='javascript:;' onclick='scrollToElement(\"").Append(involvedPlugin.Key).Append("\")'>").Append(involvedPlugin.Key).Append("</a></b>").Append("<br/>")
.Append("<ul>");
sbMain.Append("<li>");
sbMain.Append("Plugin Id: ").Append("<b><a href='javascript:;' onclick='scrollToElement(\"").Append(involvedPlugin.Key).Append("\")'>").Append(involvedPlugin.Key).Append("</a></b>");

sbMain.Append("<ul>");
foreach (var involved in involvedPlugin)
{
sbMain.Append("<li>");
sbMain.Append("Frame: ").Append(involved.EnhancedStacktraceFrameName.EscapeGenerics());
sbMain.Append("</li>");
}
sbMain
.Append("</ul>")
.Append("</li>");
sbMain.Append("/<ul>");

sbMain.Append("</li>");
}
}
private static string GetInvolvedHtml(CrashReportModel crashReport)
{
var sb = new StringBuilder();
sb.Append("From highest probability to lowest:")
.Append("<ul>");
AddInvolvedModules(crashReport, sb);
AddInvolvedPlugins(crashReport, sb);
sb.Append("</ul>");
return sb.ToString();
if (crashReport.InvolvedModules.Count > 0 || crashReport.InvolvedLoaderPlugins.Count > 0)
{
var sb = new StringBuilder();
sb.Append("From highest probability to lowest:")
.Append("<ul>");
AddInvolvedModules(crashReport, sb);
AddInvolvedPlugins(crashReport, sb);
sb.Append("</ul>");
return sb.ToString();
}
return string.Empty;
}

private static string GetInstalledModulesHtml(CrashReportModel crashReport)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private void RenderInvolvedModules()

_imgui.TextSameLine("Frame: \0"u8);
_imgui.Text(involved.EnhancedStacktraceFrameName);

_imgui.Unindent();
}

Expand All @@ -66,7 +66,7 @@ private void RenderInvolvedPlugins()

_imgui.TextSameLine("Frame: \0"u8);
_imgui.Text(involved.EnhancedStacktraceFrameName);

_imgui.Unindent();
}

Expand All @@ -77,10 +77,13 @@ private void RenderInvolvedPlugins()

private void RenderInvolvedModulesAndPlugins()
{
_imgui.Text("From highest probability to lowest:\0"u8);
_imgui.Indent();
RenderInvolvedModules();
RenderInvolvedPlugins();
_imgui.Unindent();
if (_enhancedStacktraceGroupedByModuleId.Length > 0 || _enhancedStacktraceGroupedByLoaderPluginIdId.Length > 0)
{
_imgui.Text("From highest probability to lowest:\0"u8);
_imgui.Indent();
RenderInvolvedModules();
RenderInvolvedPlugins();
_imgui.Unindent();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net45;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp3.0;net5.0-windows;</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<LangVersion>preview</LangVersion>
Expand Down
4 changes: 2 additions & 2 deletions src/BUTR.CrashReport/Utils/CrashReportModelUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static List<InvolvedModuleOrPluginModel> GetInvolvedModules(CrashReportIn
foreach (var patch in stacktrace.PatchMethods)
{
if (patch.ModuleInfo is null) continue;

involvedModels.Add(new()
{
ModuleOrLoaderPluginId = patch.ModuleInfo.Id,
Expand Down Expand Up @@ -196,7 +196,7 @@ public static List<InvolvedModuleOrPluginModel> GetInvolvedPlugins(CrashReportIn
foreach (var patch in stacktrace.PatchMethods)
{
if (patch.LoaderPluginInfo is null) continue;

involvedPluginModels.Add(new()
{
ModuleOrLoaderPluginId = patch.LoaderPluginInfo.Id,
Expand Down

0 comments on commit 4bfc076

Please sign in to comment.