text:  10087 AppDomain.ProcessExit event hangs, the process doesn't exit.
  using System;
  using System.Linq;
  using System.Threading;
  class Test {
  public static void Main ()
  {
  AppDomain.CurrentDomain.ProcessExit += (s, e) => {
  while (true) {
  Thread.Sleep (1);
  }
  };
  Environment.Exit (0);
  }
  }
  Expected behavior: The process exits after a timeout. This is what happens with .NET, in which the process exits after ~3s.
  Actual behavior: The process doesn't exit until forcibly quit (e.g. Ctrl+C).
  I can repro this.
  I can reproduce with Mono 5.4.0.135 (2017-06/6425f06)
  I closed because the approach I went with there was not a feasible solution.
  I initially tried using the finalizer thread to run ProcessExit callbacks. While this works for simple scenarios (and gets us an automatic timeout mechanism), it will not behave correctly when multiple appdomains are involved. The finalizer thread's timeout is also much longer than the timeout we want, and there could be interactions with finalizers that aren't desirable.
  The correct solution appears to be to spin up 1 or more threads directly and then use them to invoke each ProcessExit callback from within the appropriate domain. A single thread is a reasonable starting point, but it's possible the events need to be run from multiple threads, depending on how much existing applications depend on this event. It's also worth doing a test or two on the MS CLR to determine whether the timeout for ProcessExit is per-domain or is the total amount of time spent by all the events.
  When spinning up thread(s) to run the events, it's going to be necessary to make sure everything is retained by the GC - with the finalizer thread approach I ran into trouble with the GC collecting statics out from under me, so it seems like a risk that the same may happen here. I'm still not sure why that happened, since it seems like static variables should still be rooted until later in shutdown...
  It was reverted with