反射的DLL中不能加载xml文件.为什么?
Assembly asm = Assembly.LoadFrom(Directory.GetCurrentDirectory() + "\\test.dll");
Type[] ts = asm.GetTypes();
foreach (Type t in ts)
{
if (t.IsClass)
{
if (t.Name == ClassName)
{
object obj = asm.CreateInstance(t.FullName);
MethodInfo mi = t.GetMethod("TestClassname", BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(string) }, null);
List<T> st= (List<T>)mi.Invoke(obj, new object[] { TestStr });
}
}
}
test 类:
public string TestClassname( string TestStr)
{
XPathDocument doc = new XPathDocument(TestStr);
XPathNavigator nav = doc.CreateNavigator();
}
new一个xpathdocument对象时就报错,为什么呀?
Exception has been thrown by the target of an invocation.
targeinvocationexception was unhandled
怎么解决呀?