We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MainFrameBarManager and WaitAll

Hi! Sorry for my ugly english. I have next problem with threads and MainFrameBarManager control. There is minimal code that demonstates the problem (my project contains only single form and MainFrameBarManager control): private void button1_Click(object sender, System.EventArgs e) { const int numberOfThreads = 10; TT[] thrs = new TT[numberOfThreads]; ManualResetEvent[] events = new ManualResetEvent[numberOfThreads]; for(int i = 0; i < numberOfThreads; i++) { thrs[i] = new TT(); events[i] = thrs[i].event__; thrs[i].Start(); } WaitHandle.WaitAll(events, new TimeSpan(0, 0, 5), false); // On this code line environment throws unhandled exception: Additional information: WaitAll for multiple handles on an STA thread is not supported. } } public class TT { public ManualResetEvent event__ = new ManualResetEvent(false); public void Start() { new Thread(new ThreadStart(this.ThreadFunc)).Start(); } public void ThreadFunc() { this.event__.Set(); } } Without the control on the form this code working correctly. There is the error? Thanks in advance. Dive, Cuba/Varadero

1 Reply

AD Administrator Syncfusion Team May 31, 2005 06:11 PM UTC

Hi Dive, Unfortunately, MainFrameBarManager cannot function in an MTAThread, since it requires DragDrop support. So the designer is likely setting the thread property to STA when you add the MainFrameBarManager, causing the error. Regards, Gregory Austin Syncfusion Inc.

Live Chat Icon For mobile
Up arrow icon