I'm developing an application for UWP (Universal Windows Platform) with availability on Windows 10 and Xbox One devices. The app is a single user application. I'm trying to determine at runtime a unique identifier for the active signed-in user -- just an ID without any personally identifiable information. The documentation for the StoreContext class suggests that I should be able to determine this by examining the User
property on the default StoreContext
object; specifically, the NonRoamableId
property seems appropriate. However, in every context I've run the app in (debug, deployed, Windows, Xbox), the StoreContext's User
property has always been null
. Is this expected? I'm unable to find any other way to determine this information.
Of note: I'm aware of the UserWatcher class and its methods for querying users on the system. However, I would like to avoid using this for the following reasons:
- The properties exposed to the app by using these query methods are insufficient for determining which
User
is the one associated with the currentStoreContext
, meaning that such a solution would be error-prone. - Querying for user information this way results in a permissions pop-up, which makes sense if the app needs to read personally identifiable information, but since I'm just looking for a programmatic unique identifier, this doesn't seem like it should be necessary.
I'm developing against the Windows 10 Creators' Update SDK (10.0.15063).
Edit 11/16/2017
This looks like it may have been a UWP bug that is now fixed. With no code changes, I now see a non-null User
object attached to the LaunchActivatedEventArgs
on app launch. Accepted the answer accordingly.