Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Project 2010: Performance problems with "Resource.MaterialLabel"

$
0
0

Hello.

I start a Project 2010 Add In solution from scratch in VS 2013.

Then I add the following lines to "NewProject" event handler

void Application_NewProject(MSProject.Project pj)
{
    long begin = DateTime.Now.Ticks;

    for (int i = 0; i < 1000; i++)
    {
        MSProject.Resource res = pj.Resources.Add("Resource" + i.ToString());
        res.Type = MSProject.PjResourceTypes.pjResourceTypeMaterial;
        res.Code = "Unit" + i.ToString();
        //res.MaterialLabel = "Unit" + i.ToString();
    }

    TimeSpan elapsed = new TimeSpan(DateTime.Now.Ticks - begin);
    Debug.WriteLine("Elapsed: " + elapsed.TotalSeconds);
}

This code runs smoothly and takes about 3.5 seconds in my computer

Now, comment the line that assigns the code (res.Code = (...)) and uncomment the one assigning MaterialLabel.

When I run again, CPU usage goes to 100% (all 4 proccesors busy), many other Windows apps starts flickering (Excel 2010 among them) and the code takes about 50 seconds to run.

I think"Material Label" property is just a string, showing information about the units you measure your resources with, but clearly it's doing something else...

What?


Viewing all articles
Browse latest Browse all 5347

Trending Articles