Skip to content

Commit

Permalink
feat: output new plugin infos if a method's calling assembly has them
Browse files Browse the repository at this point in the history
  • Loading branch information
RobynLlama committed Aug 20, 2024
1 parent 7df11a1 commit bccac99
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/UnityDebuggerAssistant/Utils/ExceptionHandler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Runtime.ExceptionServices;
using System.Text;
using BepInEx;

namespace UnityDebuggerAssistant.Utils;

Expand All @@ -17,17 +18,29 @@ public static void Handle(Exception ex)
lastEvent = ex;

//Process the exception here
StringBuilder sb = new("\n\n--- Exception Handler ---\n");
StringBuilder sb = new("\n\n--- Exception Handler ---\n\n");

sb.Append("Exception Caught: ");
sb.AppendLine(ex.GetType().ToString());

sb.Append("Target Site: ");
sb.AppendLine(ex.TargetSite.Name);

//This might be useless info
sb.Append("Target Assembly: ");
sb.AppendLine(ex.TargetSite.GetType().Assembly.GetName().Name);
var declaringAssembly = ex.TargetSite.DeclaringType.Assembly;

sb.Append("Declaring Assembly: ");
sb.AppendLine(declaringAssembly.GetName().Name);

if (PatchStorage.InfoCache.TryGetValue(declaringAssembly, out PluginInfo info))
{
sb.AppendLine("Plugin Info");
sb.Append(" ");
sb.AppendLine(info.Metadata.GUID);
sb.Append(" ");
sb.Append(info.Metadata.Name);
sb.Append("@");
sb.AppendLine(info.Metadata.Version.ToString());
}

var blames = PatchStorage.GetPatchInformation(ex.TargetSite);

Expand Down

0 comments on commit bccac99

Please sign in to comment.