none
Microsoft.Office.Interop.MSProject throwing System.NotImplementedException RRS feed

  • Question

  • Howdy,

    Real head scratcher on this one.  I have a full description of the problem with screen shots at Stackoverflow: http://stackoverflow.com/questions/25043560/microsoft-office-interop-msproject-giving-null-at-runtime-but-has-value-in-visu  

    The crux of the issue:

    I'm opening a MSProject File in a WPF C# Program utilizing interop.  I attempt to read the Project.ProjectFinish and Project.ProjectStart properties and get a System.NotImplementedException.  However, if I look at these values in the debugger->watch window, I can see their values fine.  

    Why would my runtime code not see the value from the interop class, but the debugger would?

    Based on a few things I've read on the interweb and on this forum, I've added this code:

                if (dynProject is Microsoft.Office.Interop.MSProject.Project)            {                DateTime dtFinish = dynProject.ProjectFinish;            }

    If statement is true, but 

    DateTime dtFinish = dynProject.ProjectFinish;

    throws the System.NotImplementedException.  And, if I look at that value in the debugger, the value is there.

    Context Info

    • WPF C# .NET 4.0 Program
    • Visual Studio 2010
    • MSProject 2013
    • Microsoft.Office.Interop.MSProject v15 referenced from C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15\Microsoft.Office.Interop.MSProject.dll
    • Microsoft.Office.Interop.Office v15 referenced from C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15\Office.dll

    Full Stack Track of the Exception:

       at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)   at System.Dynamic.ComRuntimeHelpers.GetITypeInfoFromIDispatch(IDispatch dispatch, Boolean throwIfMissingExpectedTypeInfo)   at System.Dynamic.IDispatchComObject.EnsureScanDefinedMethods()   at System.Dynamic.IDispatchComObject.System.Dynamic.IDynamicMetaObjectProvider.GetMetaObject(Expression parameter)   at System.Dynamic.DynamicMetaObject.Create(Object value, Expression expression)   at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, ReadOnlyCollection`1 parameters, LabelTarget returnLabel)   at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T](CallSite`1 site, Object[] args)   at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)   at CallSite.Target(Closure , CallSite , Object )   at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0)

    Monday, August 4, 2014 2:40 PM

All replies

  • Hello,

    Did you try to use the late binding technology (see Type.InvokeMember) for getting the value? Does it help?

    Monday, August 4, 2014 3:28 PM
  • Thanks for the clue!  And yes, that gave me access to the values.  However, as I said in the Stackoverflow post, this is an upgrade to the newest Office DLLs for insured compatibility with MSProject 2013.  Why would this just start happening now?  We've been using interop DLLs for years and not had to use Late Binding.  What changed?
    Monday, August 4, 2014 4:29 PM
  • Do your culture settings correspond to the Office installed on the PC?

    I think all is ok with interop files. Most probably the current environment causes the issue.

    Monday, August 4, 2014 4:36 PM
  • Do your culture settings correspond to the Office installed on the PC?  Yes.   I have a US based Win7 machine with English Win7 installed with US English Office installed.  In the program, we specifically the culture of threads to en-US.  This started happen across all of our machines.  Seems like it might be a bug in interop dlls.  Any other reasons you can think of this would start happening?
    Monday, August 4, 2014 5:32 PM
  • Hi,

    Thank you for posting in the MSDN Forum.

    Since the issue more relate to the Project , I'd like to move it to Project Customization and Programming forum.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, August 5, 2014 2:45 AM