Skip to content

Commit f6f60c6

Browse files
committed
fix: apply whitelist to main assembly
1 parent 6b0670f commit f6f60c6

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/UnityDebuggerAssistant/Utils/ExceptionHandler.cs

+16-8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ public static void Handle(Exception ex)
3232
}
3333

3434
var trace = new StackTrace(ex, true);
35+
var assembly = targets.DeclaringType.Assembly;
36+
37+
//Filter the main assembly
38+
if (ShouldUseWhitelist() && !WhiteListContains(assembly))
39+
{
40+
#if DEBUG
41+
Plugin.Log?.LogInfo($"Skipping {assembly.GetName().Name}, not on whitelist");
42+
#endif
43+
return;
44+
}
3545

3646
static string Tabs(int n)
3747
{
@@ -189,17 +199,15 @@ static void DumpPatch(StringBuilder sb, Assembly assembly, int Indent)
189199
sb.Append("Exception Caught: ");
190200
sb.AppendLine(ex.GetType().ToString());
191201

192-
if (targets is not null)
202+
sb.Append("Assembly: ");
203+
sb.AppendLine(assembly.GetName().Name);
204+
205+
if (PatchStorage.InfoCache.TryGetValue(ex.TargetSite.DeclaringType.Assembly, out PluginInfo info))
193206
{
194-
sb.Append("Assembly: ");
195-
sb.AppendLine(targets.DeclaringType.Assembly.GetName().Name);
207+
WritePluginInfo(sb, info, 1);
208+
}
196209

197-
if (PatchStorage.InfoCache.TryGetValue(ex.TargetSite.DeclaringType.Assembly, out PluginInfo info))
198-
{
199-
WritePluginInfo(sb, info, 1);
200-
}
201210

202-
}
203211

204212
sb.Append("Message: ");
205213
sb.AppendLine(ex.Message);

0 commit comments

Comments
 (0)