Skip to content

Commit

Permalink
Fix Assembly.GetCallingAssembly() (dotnet#69225)
Browse files Browse the repository at this point in the history
  • Loading branch information
steveharter authored May 12, 2022
1 parent cbd402b commit 8420dae
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/coreclr/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1521,9 +1521,15 @@ bool SystemDomain::IsReflectionInvocationMethod(MethodDesc* pMeth)
}
CONTRACTL_END;

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

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

Expand Down Expand Up @@ -1579,13 +1585,6 @@ bool SystemDomain::IsReflectionInvocationMethod(MethodDesc* pMeth)
if (CoreLibBinder::GetExistingClass(reflectionInvocationTypes[i]) == pCaller)
return true;
}

// Check for dynamically generated Invoke methods.
if (pMeth->IsDynamicMethod())
{
if (strncmp(pMeth->GetName(), "InvokeStub_", ARRAY_SIZE("InvokeStub_") - 1) == 0)
return true;
}
}

return false;
Expand Down

0 comments on commit 8420dae

Please sign in to comment.