MS Project 2013 crashes when retrieving ProjectSummaryTask RRS feed

  • Question

  • Hi,

    The VSTO Application is failing with invalid type exception when we are trying to access the project summary task in MS Project 2013.  MS Project is being restarted automatically after the failure.

           public static void setProjId(MSProject.Project project, string projectId) {
             if (project == null)
                   setValue(project.ProjectSummaryTask, projectId);



    Return argument has an invalid type.
    6/20/2016 12:34:35 PM: Trace     at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType)
       at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object returnValue)
       at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
       at Microsoft.Office.Interop.MSProject.ProjectClass.get_ProjectSummaryTask()
       at project, String projectId)

    The plugin was developed with the below configuration.

    1. Visual Studio Ultimate 2013

    2. MS Project (references, embedded interop=false, copy local=true), Office

    3. Target .net runtime 4.0

    Runtime configuration


    1. MS Project 2013 64 bit (15.0.4823.1000 )

    2. .Net runtime 4.6

    Please let us know if you see any known issues in MS Project 2013 or with above configuration.

    Note: Same VSTO application (code) is working in MS Project 2010.



    Tuesday, June 21, 2016 5:12 AM

All replies

  • ProjectSummaryTask returns a task type and you're trying to set it to a string. I assume you're trying to set the task name. Maybe MSP 2010 was a little looser on typing? I use p.ProjectSummaryTask.Name = projectId in and it works in all versions of MSP. Maybe you just need to put project.ProjectSummaryTask.Name as the parameter.
    Tuesday, June 21, 2016 1:03 PM
  • Thanks for the reply.

    Here, the setValue() method  is our custom method to set the value on ProjectSummaryTask.Text1.

    But, the application is failing when trying to retrieve the object itself (even before entering into the method)

    Please check the exception log.



    Wednesday, June 22, 2016 6:27 AM
  • As Bill said, unless your setValue function magically knows to set the correct property, the Task object cannot be written to, especially with a string.

    So add the property, EG .Text1.

    The other possible problem is that project is a reserved word in VBA, may well be in VSTO as well. So change the MSProject.Project project to MSProject.Project proj

    I would do both of these.

    Rod Gill
    Author of the one and only Project VBA Book

    Thursday, June 23, 2016 1:39 AM
  • Hi,

    I don't think the setValue method is being called. It is failing when trying to resolve the parameters itself.

    This code is working in our development instances and failing in some of our customer instances.

    I can understand 'project' is  reserved in Macro, but how it is in This is a utility class we have written.

    BTW, the setvalue method takes one more parameter called attributeCode, I have removed it intentionally before posting. Based on it we will determine which attribute to set.

    Customer is using MS Project 2013 64-bit updated to latest using windows update.

    Instead of throwing an exception, why project is being crashed?



    Thursday, June 23, 2016 2:00 AM
  • Calling a Project "project" in C# shouldn't be a problem because it's case-sensitive. and VBA are not. Just curious, have you tried declaring a Task variable locally within the SetProjId method and assigning the Project Summary Task to it? If that works can you pass the local variable to your setValue method?

    Thursday, June 23, 2016 1:58 PM
  • Hi,

    I haven't tried that. I can give it try. I read some articles suggesting the same thing.

    We are already troubling our customer to perform many things. We need to ask them try again with this fix.

    Also found some posts which says this could happen if we have multiple installation of office products.

    We have tried many combinations to reproduce the issue, but not able to reproduce internally.

    This is consistently reproducible on customer machine with MSP 2013 64-bit.

    We have tried with MSP 2013 32-bit, MSP 2016 64-bit, MSP 2016 64-bit SP1, MSP 2016 64-bit SP1 updated to latest and with .net 4.5.2 and .net 4.6.

    Is there any way we can get to know how the Invalid cast is happening?



    Friday, June 24, 2016 4:30 PM
  • I gave up VSTO programming because there were too many issues like this. I think you need to try programming the solution in a different way to avoid this issue.

    Bill's idea of having a Task is worth trying. Change the field used, or store the data elsewhere.

    I would also look at using Add-in Express at They have been around for a while so there solution may bypass this problem.

    Rod Gill
    Author of the one and only Project VBA Book

    Friday, June 24, 2016 10:26 PM