Just verified that on MS .NET this has the following output: About to throw an exception UnhandledException ! Application Complete Press any key to continue . . .
So it seems to me this is a bug in Mono implementation. --- Adar Wesley On Wed, Dec 23, 2009 at 9:27 PM, Thad Thompson <tthomp...@nucsafe.com>wrote: > Hi, > I know this has been raised a few times in the past (bugs 332206, > 334265, and 435127) but I've looked high and low for a workaround and > just can't seem to find it. Is there any way to catch, trap, log, crash, > or in any way be notified of an unhandled exception from a ThreadPool > thread? My apologies in advance if I've overlooked something basic. > > Thanks, > -Thad > > > Example: > --------------------------------------------------------------------- > namespace MonoExceptions > { > class MainClass > { > public static void Main (string[] args) > { > try > { > AppDomain.CurrentDomain.UnhandledException += (a,b) => > { Console.WriteLine("UnhandledException !"); }; > > System.Threading.ThreadPool.QueueUserWorkItem ( (a) => > { > Console.WriteLine("About to throw an exception"); > throw new Exception("I'd really like to catch > this"); > }); > > System.Threading.Thread.Sleep(5000); > Console.WriteLine("Application Complete"); > } > catch(Exception ex) > { > Console.WriteLine("Caught exception in Main: " + > ex.Message); > } > } > } > } > --------------------------------------------------------------------- > Output: > About to throw an exception > Application Complete > > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list >
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list