While debugging my program in VS 2008, I encountered the following error:
The CLR could not move from the COM context 0x34fc1a0 to the COM context 0x34fc258 for 60 seconds. A thread that owns the target context / apartment most likely either performs a non-download or processes a very long operation without pumping Windows messages. This situation, as a rule, has a negative impact on performance and may even lead to the application becoming inactive or memory automatically accumulating over time. To avoid this
It seems to be inhibited, although the code only contains a simple C # timer: see snippet below:
private void RequestWork() { // The timer will be re-intialised if there are still no wating jobs in the database StopTimer(); // assign all the threads some work InitialiseTimer(); } /// <summary> /// Initialise a timer with a timer interval configured from app.config. Enable the timer and /// register an appropriate event handler /// </summary> private void InitialiseTimer() { if (m_Timer == null) { // look up the default backoff time from the config string backOffInt = ConfigurationSettings.AppSettings["BackOffInterval"]; int backoffInterval = 1000; m_Timer = new System.Timers.Timer(); // set the timer interval to 5 seconds m_Timer.Interval = backoffInterval; m_Timer.Elapsed += new ElapsedEventHandler(m_Timer_Elapsed); } m_Timer.Enabled = true; } private void StopTimer() { if (m_Timer != null) { m_Timer.Enabled = false; } } void m_Timer_Elapsed(object p_Sender, ElapsedEventArgs p_E) { RequestWork(); }
As far as I know, the timer should work, pass, and then initialize again, I see no local reason for the deadlock.
I know how to disable this error, but I feel that this is not a solution, instead it masks the problem.
NeedOfHelp
source share