I have Tools.dll file that contains MyMethod() like this :
public void MyMethod()
{
global::System.Windows.Forms.MessageBox.Show("Sth");
}
Now , I am trying to run this assembly method from another file :
System.Reflection.Assembly myDllAssembly = System.Reflection.Assembly.LoadFile(@"PATH\Tools.dll");
myDllAssembly.GetType().GetMethod("MyMethod").Invoke(myDllAssembly, null); //here we invoke MyMethod.
After running 'System.NullReferenceException' happens . It says "Object reference not set to an instance of an object."
So How can I fix it ?!
Im sure this .dll building truth without problem .
Note : the assembly code come from : http://ift.tt/1PP9l7M
Aucun commentaire:
Enregistrer un commentaire