From cac9f42c9752647a951003278c3f83149732ac74 Mon Sep 17 00:00:00 2001 From: ElektroKill Date: Tue, 19 Sep 2023 21:40:05 +0200 Subject: [PATCH] Improved BAML connection id analysis when dependencies are missing --- .../dnSpy.BamlDecompiler/Rewrite/ConnectionIdRewritePass.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Extensions/dnSpy.BamlDecompiler/Rewrite/ConnectionIdRewritePass.cs b/Extensions/dnSpy.BamlDecompiler/Rewrite/ConnectionIdRewritePass.cs index 3e8caea034..55b314455a 100644 --- a/Extensions/dnSpy.BamlDecompiler/Rewrite/ConnectionIdRewritePass.cs +++ b/Extensions/dnSpy.BamlDecompiler/Rewrite/ConnectionIdRewritePass.cs @@ -131,7 +131,7 @@ public void Callback(XamlContext ctx, XElement elem) { } struct EventAttachment { - public TypeDef AttachedType; + public ITypeDefOrRef AttachedType; public string EventName; public string MethodName; @@ -216,7 +216,7 @@ Dictionary> ExtractConnectionId(XamlContext c evName = evName.Substring(0, evName.Length - 5); cb += new EventAttachment { - AttachedType = reField.DeclaringType.ResolveTypeDefThrow(), + AttachedType = reField.DeclaringType.ResolveTypeDef() ?? reField.DeclaringType, EventName = evName, MethodName = IdentifierEscaper.Escape(handler.Name) }.Callback;