MSIX runFullTrust doesn't allow access to user account info

pol2095 1 Reputation point
2020-02-26T06:39:56.187+00:00

Hello,

I created a Windows Forms Application (.NET Framework) with a TextBox and a Button

I added a NuGet Package : Microsoft.Windows.SDK.Contracts to use UWP

I use this code inspired by this example

using System;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Data;  
using System.Drawing;  
using System.Linq;  
using System.Text;  
using System.Threading.Tasks;  
using System.Windows.Forms;  
using Windows.Foundation.Collections;  
using Windows.System;  
  
namespace WindowsFormsApp1  
{  
    public partial class Form1 : Form  
    {  
        public Form1()  
        {  
            InitializeComponent();  
        }  
  
        private void button1_Click(object sender, EventArgs e)  
        {  
            user();  
        }  
  
        public async void user()  
        {  
            // Populate the list of users.  
            IReadOnlyList<User> users = await User.FindAllAsync();  
            int userNumber = 1;  
            foreach (User user in users)  
            {  
                string displayName = (string)await user.GetPropertyAsync(KnownUserProperties.DisplayName);  
  
                // Choose a generic name if we do not have access to the actual name.  
                if (String.IsNullOrEmpty(displayName))  
                {  
                    displayName = "User #" + userNumber.ToString();  
                    textBox.Text += displayName + "\r\n";  
                    userNumber++;  
                }  
                ShowProperties(user);  
            }  
        }  
  
        private async void ShowProperties(User user)  
        {  
            if (user != null)  
            {  
                try  
                {  
                    // Build a list of all the properties we want.  
                    String[] desiredProperties = new String[]  
                    {  
                        KnownUserProperties.FirstName,  
                        KnownUserProperties.LastName,  
                        KnownUserProperties.ProviderName,  
                        KnownUserProperties.AccountName,  
                        KnownUserProperties.GuestHost,  
                        KnownUserProperties.PrincipalName,  
                        KnownUserProperties.DomainName,  
                        KnownUserProperties.SessionInitiationProtocolUri,  
                    };  
                    // Issue a bulk query for all of the properties.  
                    IPropertySet values = await user.GetPropertiesAsync(desiredProperties);  
  
                    // Add those properties to our results.  
                    foreach (String property in desiredProperties)  
                    {  
                        textBox1.Text += property + ": " + values[property] + "\r\n";  
                    }  
                }  
                catch (Exception ex)  
                {  
                    //Console.WriteLine(ex.Message);  
                }  
            }  
        }  
    }  
}  

then I create a msi

then I create a MSIX using MSIX Packaging tool which adds runFullTrust capacity

I launch the app and property "accountName" is empty

when I use the sample UWP, the app ask me a user account permission and property "accountName" is not empty

I think app converted with Desktop Bridge should run at full trust, with the full privileges of the user. They already have access to the user account info, to the location info, the file system, network etc... but user info is empty ?

1549496

"runFullTrust" doesn't work as expected.

Thanks for your help

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Roy Li - MSFT 32,721 Reputation points Microsoft Vendor
    2020-02-26T07:25:17.36+00:00

    Hello,

    Welcome to Microsoft Q&A!

    My teammate had replied to you here: MSIX and uap:Capability not working for classic desktop applications. Please check that.

    Thank you!