Skip to content

Commit 8420dae

Browse files
authored
Fix Assembly.GetCallingAssembly() (#69225)
1 parent cbd402b commit 8420dae

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/coreclr/vm/appdomain.cpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -1521,9 +1521,15 @@ bool SystemDomain::IsReflectionInvocationMethod(MethodDesc* pMeth)
15211521
}
15221522
CONTRACTL_END;
15231523

1524-
MethodTable* pCaller = pMeth->GetMethodTable();
1524+
// Check for dynamically generated Invoke methods.
1525+
if (pMeth->IsDynamicMethod())
1526+
{
1527+
if (strncmp(pMeth->GetName(), "InvokeStub_", ARRAY_SIZE("InvokeStub_") - 1) == 0)
1528+
return true;
1529+
}
15251530

1526-
// All Reflection Invocation methods are defined in CoreLib
1531+
// All other reflection invocation methods are defined in CoreLib.
1532+
MethodTable* pCaller = pMeth->GetMethodTable();
15271533
if (!pCaller->GetModule()->IsSystem())
15281534
return false;
15291535

@@ -1579,13 +1585,6 @@ bool SystemDomain::IsReflectionInvocationMethod(MethodDesc* pMeth)
15791585
if (CoreLibBinder::GetExistingClass(reflectionInvocationTypes[i]) == pCaller)
15801586
return true;
15811587
}
1582-
1583-
// Check for dynamically generated Invoke methods.
1584-
if (pMeth->IsDynamicMethod())
1585-
{
1586-
if (strncmp(pMeth->GetName(), "InvokeStub_", ARRAY_SIZE("InvokeStub_") - 1) == 0)
1587-
return true;
1588-
}
15891588
}
15901589

15911590
return false;

0 commit comments

Comments
 (0)