The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator 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.