diff --git a/ILSpy/Images/AssemblyLoading.svg b/ILSpy/Images/AssemblyLoading.svg
new file mode 100644
index 0000000000..9281b25e61
--- /dev/null
+++ b/ILSpy/Images/AssemblyLoading.svg
@@ -0,0 +1,49 @@
+
+
diff --git a/ILSpy/Images/AssemblyLoading.xaml b/ILSpy/Images/AssemblyLoading.xaml
new file mode 100644
index 0000000000..cd2fb7143c
--- /dev/null
+++ b/ILSpy/Images/AssemblyLoading.xaml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ILSpy/Images/Images.cs b/ILSpy/Images/Images.cs
index 49dfde0fd6..b11bbc64cd 100644
--- a/ILSpy/Images/Images.cs
+++ b/ILSpy/Images/Images.cs
@@ -51,6 +51,7 @@ static ImageSource Load(string icon)
public static readonly ImageSource Assembly = Load("Assembly");
public static readonly ImageSource AssemblyWarning = Load("AssemblyWarning");
+ public static readonly ImageSource AssemblyLoading = Load(nameof(AssemblyLoading));
public static readonly ImageSource FindAssembly = Load("FindAssembly");
public static readonly ImageSource Library = Load("Library");
diff --git a/ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs b/ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs
index 57a326353e..c256abf3e5 100644
--- a/ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs
+++ b/ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs
@@ -1,14 +1,14 @@
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
-//
+//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
@@ -35,9 +35,18 @@ namespace ICSharpCode.ILSpy.TreeNodes
///
public sealed class AssemblyReferenceTreeNode : ILSpyTreeNode
{
+ private enum LoadState
+ {
+ Unloaded,
+ Loading,
+ Loadded,
+ Failed
+ }
readonly MetadataModule module;
readonly AssemblyReference r;
readonly AssemblyTreeNode parentAssembly;
+ MetadataFile referencedModule;
+ private LoadState state;
public AssemblyReferenceTreeNode(MetadataModule module, AssemblyReference r, AssemblyTreeNode parentAssembly)
{
@@ -53,7 +62,27 @@ public override object Text {
get { return Language.EscapeName(r.Name) + GetSuffixString(r.Handle); }
}
- public override object Icon => ImagesProvider.Assembly;
+ public override object Icon {
+ get {
+ if (state == LoadState.Unloaded)
+ {
+ state = LoadState.Loading;
+ Dispatcher.CurrentDispatcher.BeginInvoke(() => {
+ var resolver = parentAssembly.LoadedAssembly.GetAssemblyResolver();
+ referencedModule = resolver.Resolve(r);
+ state = referencedModule is null
+ ? LoadState.Failed
+ : LoadState.Loadded;
+ RaisePropertyChanged(nameof(Icon));
+ }, DispatcherPriority.Background);
+ }
+ return state switch {
+ LoadState.Loadded => Images.Assembly,
+ LoadState.Failed => Images.AssemblyWarning,
+ _ => Images.AssemblyLoading,
+ };
+ }
+ }
public override bool ShowExpander {
get {
@@ -65,7 +94,7 @@ public override bool ShowExpander {
// while the list of references is updated causes problems with WPF's ListView rendering.
// Moving the assembly resolving out of the "add assembly reference"-loop by using the
// dispatcher fixes the issue.
- Dispatcher.CurrentDispatcher.BeginInvoke((Action)EnsureLazyChildren, DispatcherPriority.Normal);
+ Dispatcher.CurrentDispatcher.BeginInvoke(EnsureLazyChildren, DispatcherPriority.Normal);
}
return base.ShowExpander;
}