Skip to content

Commit b6f606e

Browse files
feat(UI): Use AssemblyWarning when AssemblyReference load faulted
Allow you to easily and quickly see the reference libraries not found fixes #2932
1 parent 4514e33 commit b6f606e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs

+20-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public sealed class AssemblyReferenceTreeNode : ILSpyTreeNode
3131
{
3232
readonly AssemblyReference r;
3333
readonly AssemblyTreeNode parentAssembly;
34+
private bool? loadFualt;
3435

3536
public AssemblyReferenceTreeNode(AssemblyReference r, AssemblyTreeNode parentAssembly)
3637
{
@@ -45,7 +46,11 @@ public override object Text {
4546
get { return Language.EscapeName(r.Name) + GetSuffixString(r.Handle); }
4647
}
4748

48-
public override object Icon => Images.Assembly;
49+
public override object Icon => loadFualt switch
50+
{
51+
true => Images.AssemblyWarning,
52+
_ => Images.Assembly
53+
};
4954

5055
public override bool ShowExpander {
5156
get {
@@ -79,9 +84,15 @@ protected override void LoadChildren()
7984
var module = resolver.Resolve(r);
8085
if (module != null)
8186
{
87+
loadFualt = false;
8288
foreach (var childRef in module.AssemblyReferences)
8389
this.Children.Add(new AssemblyReferenceTreeNode(childRef, parentAssembly));
8490
}
91+
else
92+
{
93+
loadFualt = true;
94+
}
95+
RaisePropertyChanged(nameof(Icon));
8596
}
8697

8798
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
@@ -100,14 +111,22 @@ public override void Decompile(Language language, ITextOutput output, Decompilat
100111
output.Indent();
101112
language.WriteCommentLine(output, "Assembly reference loading information:");
102113
if (info.HasErrors)
114+
{
103115
language.WriteCommentLine(output, "There were some problems during assembly reference load, see below for more information!");
116+
loadFualt = true;
117+
}
118+
else
119+
{
120+
loadFualt = false;
121+
}
104122
foreach (var item in info.Messages)
105123
{
106124
language.WriteCommentLine(output, $"{item.Item1}: {item.Item2}");
107125
}
108126
output.Unindent();
109127
output.WriteLine();
110128
}
129+
RaisePropertyChanged(nameof(Icon));
111130
}
112131
}
113132
}

0 commit comments

Comments
 (0)