Reputation: 2085
This is a C# console application. I have a function that does something like this:
static void foo()
{
Application powerpointApp;
Presentation presentation = null;
powerpointApp = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();
}
That's all it does. When it is called there is a fifteen second delay before the function gets hit. I added something like this:
static void MyAssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs args)
{
Console.WriteLine(DateTime.Now.ToString() + " ASSEMBLY LOADED: " + args.LoadedAssembly.FullName);
Console.WriteLine();
}
This gets fired telling me that my interop assemblies have been loaded about 10 milliseconds before my foo function gets hit. What can I do about this? The program needs to call this function (and eventually do something else) once and then exit so I need for these assemblies to be cached or something. Ideas?
Upvotes: 1
Views: 542
Reputation: 3061
<runtime>
<generatePublisherEvidence enabled="false"/>
</runtime>
See here for details
http://msdn.microsoft.com/en-us/library/bb629393.aspx
"We recommend that services use the element to improve startup performance. Using this element can also help avoid delays that can cause a time-out and the cancellation of the service startup."
Upvotes: 0
Reputation: 5226
It could be the certificate revocation list - the time-out on this is 15 seconds. Is there anything in the event log? Can you check if any network connections are happening during the time-out?
I blogged some details about certificate revocation delay a while ago. Follow the link, I won't cut and paste it here.
Upvotes: 4
Reputation: 571
15 seconds sounds like a timeout to me. Are you signing your assemblies? We had a problem where the framework wants to check the certificate revocation list when loading, but fails after 15 secs.
HTH
Tim
Upvotes: 3
Reputation: 22310
If method foo() is not called upon application start and you have some other tasks to do before it is called, you can start a separate thread in the beginning to load the assemblies.
Upvotes: 0
Reputation: 22344
Just guessing, but it is probably the time for PowerPoint to start up after the interop assemblies have loaded.
Upvotes: 0