매우 분별력있는 사람으로부터 스레드에서 던져진 (그리고 잡히지 않은) 예외가 부모 스레드로 전파되고 있음을 들었습니다. 그게 사실이야? 이 같은 것을 시도했지만 생성 스레드에서 예외를 catch 할 수 없습니다.다중 스레드 응용 프로그램의 예외.
static void Main(string[] args)
{
ParameterizedThreadStart pts =
new ParameterizedThreadStart(ThreadMethod);
try
{
Thread t = new Thread(pts);
t.Start(new object());
Console.ReadLine();
}
catch (Exception ex) //the exception is not caught
{
Debugger.Break();
}
}
static void ThreadMethod(object @object)
{
Thread.Sleep(2000);
throw new IndexOutOfRangeException();
Thread.CurrentThread.Abort();
}
나는 단지 당신이 예외가 사용 http://msdn.microsoft.com/en-us/library/system을 잡은 경우보고 싶은 경우는,에 발생 스레드에 던져 확신합니다. backgroundworker 대신 componentmodel.backgroundworker.runworkercompleted.aspx 완료 –