I need to find the assembly in which managed code execution started.
// using System.Reflection;
Assembly entryAssembly = Assembly.GetEntryAssembly();
This seems like the way to go, but the MSDN reference page for Assembly.GetEntryAssembly
states that this method "[c]an return null when called from unmanaged code."
In that case, I would like to know which assembly was called by unmanaged code.
Is there a reliable way of doing this, i.e. one that always returns a non-null Assembly
reference?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…