Skip to content

Commit

Permalink
Fix #3263: Properly handle assemblies that do not provide a type syst…
Browse files Browse the repository at this point in the history
…em in DerivedTypesTreeNode.
  • Loading branch information
siegfriedpammer committed Aug 17, 2024
1 parent 76cc084 commit d0d60f9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ILSpy/TreeNodes/DerivedTypesTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
// DEALINGS IN THE SOFTWARE.

using System.Collections.Generic;
using System.Linq;
using System.Threading;

using ICSharpCode.Decompiler;
Expand Down Expand Up @@ -66,12 +65,16 @@ internal static IEnumerable<DerivedTypesEntryNode> FindDerivedTypes(AssemblyList
{
var definitionMetadata = type.ParentModule.MetadataFile.Metadata;
var metadataToken = (SRM.TypeDefinitionHandle)type.MetadataToken;
var assemblies = list.GetAllAssemblies().GetAwaiter().GetResult()
.Select(node => node.GetMetadataFileOrNull()).Where(asm => asm != null).ToArray();
foreach (var module in assemblies)
var assemblies = list.GetAllAssemblies().GetAwaiter().GetResult();
foreach (var loadedAssembly in assemblies)
{
var module = loadedAssembly.GetMetadataFileOrNull();
if (module == null)
continue;
var metadata = module.Metadata;
var assembly = (MetadataModule)module.GetTypeSystemOrNull().MainModule;
var assembly = module.GetTypeSystemOrNull()?.MainModule as MetadataModule;
if (assembly != null)
continue;
foreach (var h in metadata.TypeDefinitions)
{
cancellationToken.ThrowIfCancellationRequested();
Expand Down

0 comments on commit d0d60f9

Please sign in to comment.