title: Microsoft.Office.Interop.MSProject giving null at runtime, but has value in Visual Studio debugger
body: <p>I'm having a strange issue related to talking to Microsoft.Office.Interop.MSProject.  I'm using MSProject 2013 with Office.DLL v15 and Microsoft.Office.Interop.MSProject.DLL v15.  We are updating our program, which sync's data between our product and project to use the latest DLLs, to support MSProject 2013.  I'm going to attach images of code so you can see what I'm seeing.   </p>
  
  <p>I have a local variable that is assigned the value of the Project using the Interop class.  </p>
  
  <p>'Assembly Microsoft.Office.Interop.MSProject
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15\Microsoft.Office.Interop.MSProject.dll'</p>
  
  <p>I'm looking for a value from Project.ProjectStart, which when I use the watch window shows a value.  </p>
  
  <p><img src="https://i.stack.imgur.com/V2SbF.png" alt="Watch Window Shows Value for Project.ProjectStart = valid value"></p>
  
  <p>BUT, when the code actually executes, the value of Project.ProjectStart = Null.  </p>
  
  <p><img src="https://i.stack.imgur.com/e6w9d.png" alt="Scope Shows Value for Project.ProjectStart = Null"></p>
  
  <p>Things I've checked:</p>
  
  <ul>
  <li>Make sure that all projects build to x86 and that the Project I'm using is x86.  However, I am on a 64bit Win7 machine.  Could this be a x86 vs x64 dll issue?</li>
  </ul>
  
  <p>This is a stumper.  I'll buy you a Mountain Dew if you can help me out ;)</p>
  
  <p><strong>ANSWER FOUND!!!</strong></p>
  
  <p>This solution applies to all Microsoft.Office.Interop similar issues across all office apps.  </p>
  
  <p>Here is a thread I started on MSDN that found me my answer.  <a href="http://social.msdn.microsoft.com/Forums/office/en-US/079ed850-b8ee-4d5f-93ad-a31f6d9c2607/microsoftofficeinteropmsproject-throwing-systemnotimplementedexception?forum=officegeneral#079ed850-b8ee-4d5f-93ad-a31f6d9c2607" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/office/en-US/079ed850-b8ee-4d5f-93ad-a31f6d9c2607/microsoftofficeinteropmsproject-throwing-systemnotimplementedexception?forum=officegeneral#079ed850-b8ee-4d5f-93ad-a31f6d9c2607</a>  </p>
  
  <p>Did you try to use the late binding technology (see Type.InvokeMember) for getting the value? Does it help?  YES! is and answer.  <a href="http://msdn.microsoft.com/en-us/library/66btctbe(v=vs.110).aspx" rel="nofollow noreferrer">Type.InvokeMember</a> works.  </p>
  
  <p>Here is a code snippet that I now use to access these members.  </p>
  
  <pre><code>    public DateTime LateBindProjectStart()
      {
          try
          {
              if (project != null)
              {
                  if (project is Microsoft.Office.Interop.MSProject.Project)
                  {
                      DateTime dtStart = (DateTime)(typeof(Microsoft.Office.Interop.MSProject.Project).InvokeMember(
                          "ProjectStart",
                          BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public,
                          null,
                          project,
                          null));
                      return dtStart;
                  }
                  else
                      return DateTime.MinValue;
              }
              else
                  return DateTime.MinValue;
          }
          catch (Exception ex)
          {
              throw ex;
          }
      }
  </code></pre>