I had this behavior today in the Universal Store app for Win 8.1, so this can help you. I had various exceptions (FileNotFoundException and just System.Exception), so I'm not sure if this is the same problem.
As for my experiments, this is what ContactPicker currently needs to work:
- ContactPicker instance must be created in the UI thread
- contactPicker.DesiredFieldsWithContactFieldType must have exactly one element (exception from 0 or> 1 elements)
Here is what I did:
// using Windows.ApplicationModel.Core; // in an async method: Contact user = null; AutoResetEvent resetEvent = new AutoResetEvent(false); await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, (async ()=>{ ContactPicker contactPicker = new ContactPicker(); contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber); user = await contactPicker.PickContactAsync(); resetEvent.Set(); } ); resetEvent.WaitOne(); if (user != null) { // do smth }
source share