/// ------------------------------------------------------------------------------------ /// <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(); } } }
/// <summary/> public override void BeforeTest(TestDetails testDetails) { base.BeforeTest(testDetails); #if !__MonoCS__ ManifestHelper.CreateActivationContext(); #endif }