none
PersonID Not Constant Value in SODA Application RRS feed

  • Question

  • I've been creating a simple SODA application based on the example found here. I implemented that sample as instructed and everything worked fine.

    The only real change I've made is to add code to compare the PersonId I've stored with the PersonId that's been fetched:

    foreach (PersonInfo authorizedPerson in authorizedPeople)
    {
         try
         {
              if (authorizedPerson.PersonId.Equals(storedId))
              {
                   //does stuff
              }
    }
    catch (HealthServiceException ex)
    {
         // handles exception
    }
    

     


    My code works--almost. The problem is that the PersonId returned by authorizedPerson.PersonId is not constant. I get different values returned frequently enough to make debugging other problems in the code pretty much impossible. The different values I get do seem to always be one of two values, but I haven't found any consistent way to trigger one or the other, nor have I determined what triggers a different value.

    It was my understanding that PersonId was a constant, preset value, is this not the case? Am I doing something wrong? I haven't changed anything else except to set up a few extra variables I'll need later. 

    Any tips, hints, or ideas would be more than welcome.

    Thanks!

    [Note: I have tried commenting out everything following this code block--the parts I'm trying to debug in the first place--to see if that makes a difference; it doesn't appear to do so.]

    • Edited by a.t.brown Thursday, January 26, 2012 12:32 AM minor clarification
    Thursday, January 26, 2012 12:30 AM

Answers

  • Since you are the only one using this app, you can login to HealthVault Shell at https://account.healthvault-ppe.com/ and look at the sharing tab. Do you see more than one authorization for your app?

    Also, when you say normal and debugging mode, can you say more about that? Are you by chance using both the simulator and an actual device?

    • Marked as answer by a.t.brown Friday, January 27, 2012 3:03 PM
    • Unmarked as answer by a.t.brown Friday, January 27, 2012 3:03 PM
    • Marked as answer by a.t.brown Friday, January 27, 2012 3:06 PM
    Friday, January 27, 2012 3:19 AM

All replies

  • Hi,

    Person-id is unique for an application and will remain constant forever.  That fact is of utmost importance for offline access.  Different applications (with different application-ids) will see different person-ids for the same HealthVault person.

    If you are getting different ids back, it indicates one of two things.  Either you are using a different application-id, or two people have authorized your application. 

    --Rob

    Thursday, January 26, 2012 7:21 PM
  • I am not using different application ids, and since this is still in testing mode I should be the only person who could have authorized the application. I haven't had the issue in a few hours today, so I'm hopeful that it's just a system quirk of some kind. 

    [Edit] I spoke too soon, it's changing again. It literally changes between runs of the same compiled version. [/Edit]
    • Edited by a.t.brown Thursday, January 26, 2012 9:19 PM update
    Thursday, January 26, 2012 9:09 PM
  • It looks like I get different PersonIds in normal and debugging mode, and the only one that lets me retrieve/update data is the one that I get in debugging mode. I double-checked, and regardless of which mode I'm in, there is only one authorized person. Is there a place in the config center to check who's authorized my application?
    Thursday, January 26, 2012 9:43 PM
  • Since you are the only one using this app, you can login to HealthVault Shell at https://account.healthvault-ppe.com/ and look at the sharing tab. Do you see more than one authorization for your app?

    Also, when you say normal and debugging mode, can you say more about that? Are you by chance using both the simulator and an actual device?

    • Marked as answer by a.t.brown Friday, January 27, 2012 3:03 PM
    • Unmarked as answer by a.t.brown Friday, January 27, 2012 3:03 PM
    • Marked as answer by a.t.brown Friday, January 27, 2012 3:06 PM
    Friday, January 27, 2012 3:19 AM
  • @Scott: I didn't find more than one person listed as authorized, but it did list the app as installed twice (on the same computer). I removed one of those authorizations, and I'll test things when I get to work tomorrow morning.

    As for normal and debugging mode, I meant running the  app in Visual Studio with and without debugging (F5 vs CTRL+F5). In my installation, the display shifts to show debugging information. Sorry for any confusion, and thanks for your help! 

    [Edit] Yes, that was it. I'm proposing Scott's response as answer since it was what helped me find the problem.[/Edit]
    • Edited by a.t.brown Friday, January 27, 2012 3:06 PM update
    Friday, January 27, 2012 3:46 AM