我可以在我的.NET4盒子上复制这个,你说得对——它只发生在.NET4.0上。
这闻起来很像一个虫子,我应该继续MS连接。
少校
如果这是绊倒你的崩溃处理程序。听起来解决这个问题的一个不好的方法是将调用的方法包装在自己的处理程序中-(
namespace trash {
public class Class1 {
public void CallMe() {
string blah = null;
blah.ToLower();
}
}
class Program {
static void Main(string[] args) {
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
var class1 = typeof(Class1);
var method = class1.GetMethod("CallMe");
try {
var obj = new Class1();
method.Invoke(obj, null);
}
catch (System.Reflection.TargetInvocationException) {
Console.Write("what you would expect");
}
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) {
Console.Write("it would be horrible if this got tripped but it doesn't!");
}
}
}