linux-packaging-mono/mono/tests/threadpool-exceptions7.cs
Xamarin Public Jenkins (auto-signing) 6bdd276d05 Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
2017-04-10 11:41:01 +00:00

32 lines
596 B
C#

using System;
using System.Threading;
class Test {
static int Main ()
{
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
OtherDomain ();
return 0;
}
static void OtherDomain ()
{
AppDomain domain = AppDomain.CreateDomain ("test");
ThreadPool.QueueUserWorkItem (unused => {
domain.DoCallBack (() => {
// This will get a ThreadAbortedException
Thread.Sleep (10000);
});
});
Thread.Sleep (1000);
AppDomain.Unload (domain);
}
static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
{
Environment.Exit (1);
}
}