I have a program that I run, and in the middle I get this message:
The Managed Debugging Assistant "ContextSwitchDeadlock" detected a problem in "C: \ Documents and Settings \ Lena G \ My Documents \ SchoolStuff \ IR Information \ Home Work \ FianlProject \ finalProject \ finalProject \ bin \ Debug \ finalProject.vshost. Exe '. Additional Info: The CLR was unable to switch from the context of COM 0x3407968 to the context of COM 0x3407ad8 within 60 seconds.The flow 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 is usually has a negative effect on performance and may even lead to dix becomes inactive or memory automatically accumulates over time. To avoid this problem,all threads with one thread (STA) should use primitives waiting for pumping (for example, CoWaitForMultipleHandles) and regularly pump messages during long operations.
I understand that this has something to do with the fact that it works for 60 seconds without stopping, or something like that? How is this a problem? I also placed [STAThread] in front of my main program, because if I delete it, this will show me this message:
An unhandled exception of type "System.Threading.ThreadStateException" occurred in System.Windows.Forms.dll Additional information: The current thread must be set to single-threaded apartment mode (STA) before OLE calls can be made. Make sure your main function has the STAThreadAttribute marked on it. This exception occurs only if a debugger is attached to the process.
Does anyone know how I can solve this problem?
Thanks in advance,
Lena
Lena