Creating control in a threadpool thread slows down Excel startup ( bug in framework?).

Tech-Archive recommends: Fix windows errors by optimizing your registry



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?

.



Relevant Pages

  • Re: Running Excel Addin from VBA in Access....HELP!!
    ... You initially build a macro in Excel to do what you want, ... imbeds it in an Excel file of your choosing, then runs it as a macro. ... code that creates an Excel file, ... Dim objUniqueTeams As Object ...
    (microsoft.public.access.modulesdaovba)
  • Re: Real Workaround for Excel Link Bug in 2007?
    ... you'd need the Excel file in the local directory. ... Or did you mean local HDD vs "the same directory as the PPT itself"? ...
    (microsoft.public.powerpoint)
  • Re: Import same Excel ranges from many workbooks
    ... Import Data from that EXCEL File via TransferSpreadsheet" in your suggested ... Dim strTable As String, strBrowseMsg As String ... accept the named ranges from those Excel workbooks without errors. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Importing data from Excel 2003 to Access 2003
    ... On which code step does the debugger highlight for the "object/class" error? ... Dim strPathFile As String, strFile As String, strPath As String ... ' Change this next line to True if the first row in EXCEL worksheet ... in the rest) of an Excel file and puts the data in an Access table. ...
    (microsoft.public.access.externaldata)
  • RE: Issue with UNC Path (I think). Trying to build Dynamic Report
    ... Table and then suck in all the data from my Excel sheet on the network drive. ... easy to find the UNC path for a drive litter. ... Function UNCDrive(strUNCName As String) As String ... I am trying to Link to an Excel file on a network drive and build a Report ...
    (microsoft.public.access.formscoding)