0
我想从另一个装配在winform调用方法这样TargetInvocationException中的WinForms
private void loadToolStripMenuItem_Click(object sender, EventArgs e){
Thread thread = new Thread(() =>
{
string assemblyPath = "PluginForSnake.dll";
AppDomain domain = AppDomain.CreateDomain("MyNewDomain");
ObjectHandle handle = domain.CreateInstanceFrom(assemblyPath, "PluginForSnake.Save");
object obj = handle.Unwrap();
MessageBox.Show("found");
if (RemotingServices.IsTransparentProxy(obj)){
Type type = obj.GetType();
object[] param = new object[] { _snake, _food };
MethodInfo saveGame = type.GetMethod("saveGame");
saveGame.Invoke(obj, param);
}
});
thread.IsBackground = true;
thread.Start();
}
但即时得到这个异常的调用线
类型的未处理的异常“System.Reflection.TargetInvocationException '发生在mscorlib.dll中
什么是内部异常? –
我没有写任何东西。 –