MS Project taking too long to load

M

Mark B

i've developed a .net plug-in for importing and exporting MS Project files
into my companies bespoke database. The main system uses reflection to load
the plug-in assemblies at runtime.

The project which handles all the MS Project code seems to take around 16
seconds to load when the reflection code calls the
Assembly.GetExportedTypes() method on it, and through various tracing it is
this command which takes the time.

This only happens when the client PC doesnt have MS Project installed.

Naturally this command will load the types and dependant project references
types, and I'm convinced it has something to do with when it loads the
Interop.MSProject assembly.

Is there anyone who an help with trying to sort this problem?
 
S

Stephen Sanderlin

Well, late-binding through Reflection is always slower (sometimes
significantly) than early-binding through references. The performance
penalty can become very significant depending on how you choose to
perform your invocations. There is also a variable speed penalty
(meaning in most cases it's small, but not always) associated with using
an assembly that is not in the GAC.



I'm inclined to believe that it loads faster on clients with Pro
installed because these systems load the PIA assembly from the GAC at
some point. Though I would assume that this assembly is loaded when Pro
is started, I've never done any in-depth investigation on precisely when
and under what circumstances this assembly is loaded.



Articles that may be of use:

http://msdn.microsoft.com/en-us/magazine/cc163759.aspx

http://msbdusers.net/blogs/shahedkhan/archive/2007/01/22/404.aspx

http://msdn.microsoft.com/en-us/magazine/cc163655.aspx



Other than that, the only thing I can really offer is to suggest that
you avoid using Reflection except when absolutely necessary.



Out of curiosity, why are you choosing to use Reflection as opposed to a
reference?


--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com
 
M

Mark B

Hi Stephen, thanks for the response :)

In answer to your question, the reason I am using reflection is because the
plug-in system we have simply searches the bin folder for assemblies with a
particular name convention and then checks if they implement certain
interfaces.

This allows us to keep our application dynamic in its component loading.
What is frustrating about this, is that we also have developed an Excel
component too, and the assembly types discovery is very quick.

Also, as a further test to ensure that our dynamic assembly discovery was
not causing any problems, I created a simple console app which writes random
tasks and resources to project files, this doesnt use reflection at all, just
a reference.

When MS Project is installed, it loads in a quick time as you would expect,
however when MSP isnt installed it takes exactly the same long time that the
reflection method does, so it would appear that the reflection overhead is
minimal.

It would be interesting to investigate how introp assemblies communicate to
their COM components...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top