xceções em aplicativos multithrea
Ouvi de uma pessoa muito exigente que uma exceção sendo lançada (e não capturada) em um segmento está sendo propagada para o segmento pai. Isso é verdade? Eu tentei algo assim, mas não consegui capturar a exceção no segmento de criaçã
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();
}