troubleshooting Question

C# Win Form STA Thread is not supported

Avatar of mcs26
mcs26 asked on
.NET ProgrammingMicrosoft Development
4 Comments2 Solutions640 ViewsLast Modified:

I had a class I used that use's multiple threads. I have since added this class to a new windows from project. The code complies however at the line below,


an NotSupportedException was unhandlewed is thrown. The error message is "WaitAll for multiple handles on a STA thread is not supported".

After reading some webpages on google, what I understand is that a window form run in single thread so cannot use multi threading without changing the attribute to MTA. Is this correct and how do I do such a thing? Also is this the same for WPF forms as I'm looking to learn about them very soon.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros