locked
D365 - Unhandled Exception: System.InvalidOperationException: Metadata contains a reference that cannot be resolved RRS feed

  • Question

  • Hi 

    With recent update to D365, the following code fails. 

    In my App.config file.

      <microsoft.xrm.client>
        <contexts>
          <add name="Xrm" type="Xrm.XrmServiceContext, Xrm" connectionStringName="Xrm"/>
        </contexts>
      </microsoft.xrm.client>
      <connectionStrings>
        <add name="Xrm" connectionString="Url=https://company.crm.dynamics.com; Username=user1; Password=Password-1; authtype=Office365"/>
        
      </connectionStrings>

    I generated early bound file "Xrm.cs"  and in the code file, I am calling XRMServicecontext as below.


    using (XrmServiceContext orgContext = new XrmServiceContext("Xrm"))

    try

    { var monitor = (from m in orgContext.CreateQuery("account") select m).FirstOrDefault(); }


    It fails because of recent update to D365 and I believe this was depreciated.  I referred to numerous online resources but couldn't get it to work. Can someone suggest what do I need to do?  some sample would be appreciated (instead of providing the URLs)

    Appreciate your assistance with this 

    Monday, July 3, 2017 8:46 PM