In our program, the splash screen is used in a separate thread. When the main thread finishes some jobs, it aborts the splash thread.
Here is the code:
if (thread != null && thread.IsAlive)
{
try
{
thread.Abort();
}
catch (ThreadAbortException)
{
Debug.WriteLine("Splash thread aborted");
}
}
When used in a local or network computer, it works just fine.
When used in a terminal server, we get this exception:
System.Threading.ThreadAbortException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Thread was being aborted.
Stack trace:
System.ServiceModel.Diagnostics.DiagnosticTrace.UnhandledExceptionHandler(Object sender, UnhandledExceptionEventArgs args)
MS.Win32.UnsafeNativeMethods.ITfMessagePump.GetMessageW(MSG& msg, Int32 hwnd, Int32 msgFilterMin, Int32 msgFilterMax, Boolean& result)
System.Windows.Threading.Dispatcher.GetMessage(MSG& msg, IntPtr hwnd, Int32 minMessage, Int32 maxMessage)
System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
System.Windows.Window.ShowHelper(Object booleanBox)
System.Windows.Window.Show()
System.Windows.Window.ShowDialog()
OurApplication.App.<>c__DisplayClass8.<Application_Startup>b__0()
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
System.Threading.ThreadHelper.ThreadStart()
The Trace shows this as an Unhandled Exception, yet it uses a catch. It raises the question if its running on a terminal server has something to do with it.
Does a terminal server create a special context that handles threads differently?