/// ------------------------------------------------------------------------------------
        /// <summary>
        /// Executes the background task.
        /// </summary>
        /// <remarks>This method runs in the background thread!</remarks>
        /// ------------------------------------------------------------------------------------
        private void RunBackgroundTask(object sender, DoWorkEventArgs e)
        {
            if (string.IsNullOrEmpty(Thread.CurrentThread.Name))
            {
                Thread.CurrentThread.Name = "Background thread";
            }

            if (MiscUtils.RunningTests)
            {
                ManifestHelper.CreateActivationContext();
            }
            m_Exception = null;
            m_RetValue  = null;

            try
            {
                m_RetValue = m_backgroundTask(this, m_parameters);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Got exception in background thread: " + ex.Message);
                m_Exception = ex;
            }
            finally
            {
                if (MiscUtils.RunningTests)
                {
                    ManifestHelper.DestroyActivationContext();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary/>
        public override void AfterTest(TestDetails testDetails)
        {
#if !__MonoCS__
            ManifestHelper.DestroyActivationContext();
#endif

            base.AfterTest(testDetails);
        }