Skip to content

Commit

Permalink
BUGFIX: Test whether type's scope is the current assembly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Washi1337 committed Nov 7, 2023
1 parent 9d4cf16 commit 7403692
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/AsmResolver.DotNet/DefaultMetadataResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ public TypeResolution(IAssemblyResolver resolver)
switch (scope.MetadataToken.Table)
{
case TableIndex.AssemblyRef:
if (reference.Module?.Assembly is { } assembly)
{
// Are we referencing the current assembly the reference was declared in?
if (SignatureComparer.Default.Equals(scope.GetAssembly(), assembly))
return FindTypeInModule(reference.Module, reference.Namespace, reference.Name);
}

var assemblyDefScope = _assemblyResolver.Resolve((AssemblyReference) scope);
return assemblyDefScope is not null
? FindTypeInAssembly(assemblyDefScope, reference.Namespace, reference.Name)
Expand Down

0 comments on commit 7403692

Please sign in to comment.