none
Null Refererence Exception when calling PersonInfo.CreateFromXML in HealthVault c# RRS feed

  • Question

  • I am writing a fixture for the PersonInfo class in HealthVault for use in unit tests. I have already taken the XML from an existing PersonInfo and stored it locally in a file. I am know attempting to use the PersonInfo.CreateFromXML but it is causing a null reference exception with no indicators as to what is causing it.    

    First of all is this the correct way of using this function and secondly what can i do to make it return a PersonInfo object

        public class PersonInfoFixture
        {
             Guid _app_Id = new Guid("450ea7d3-64c8-45bf-abeb-80831075080a");
             string _app_name = "AppName";
             string _app_url = "https://platform.healthvault-ppe.co.uk/platform";
             string _shell_url = "https://account.healthvault-ppe.co.uk";
        
             string _person_xml_path = "C:/Work/MI-HV-TEST/Fixtures/HealthVault/XML/person.xml";
        
             public PersonInfo Get_person_fixture()
             {
                 var hs = new HealthServiceInstance(_app_Id.ToString(), _app_name, "" , new Uri(_app_url), new Uri(_shell_url));
                 var app = new ApplicationConnection(_app_Id, hs);
                 var doc = new XPathDocument(_person_xml_path);
                 var navigator = doc.CreateNavigator();
        
                 return PersonInfo.CreateFromXml(app, navigator) as PersonInfo;
              }
        }
    Wednesday, March 26, 2014 1:27 PM

All replies