| kjartan.storli@gmail.com 2005-09-30, 6:58 pm |
| Hi,
Below is a small application which recreates a problem we found in one
of our
programs.
When this application is run it takes almost a minute to start Excel if
you double-click on an Excel file. It seems like it has the same effect
on other programs which is started with DDE commands.
class ThreadPoolTest
{
static void Main(string[] args)
{
System.Threading.TimerCallback ts = new
System.Threading.TimerCallback(CallbackTarget);
System.Threading.Timer t = new System.Threading.Timer(ts , null , 0 ,
3000);
System.Windows.Forms.Application.Run();
}
private static void CallbackTarget(object o)
{
System.Windows.Forms.Control c = new System.Windows.Forms.Control();
c.CreateControl();
}
}
Notice that during program execution the CallbackTarget function is
called in a threadpool thread.
If you try to start Excel by double clicking on an Excel file while the
app is running, it takes a long time before Excel is loaded ( sometimes
over a minute).
I understand that creating a control on a threadpool thread might be a
bit strange, but I haven't understood *why* this affects other
programs.
Can someone explain this behavour, or is it a bug in the .Net framework?
|