question

pol2095-8503 avatar image
0 Votes"
pol2095-8503 asked ·

MSIX runFullTrust doesn't allow access to user account info

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


windows-uwp
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RoyLi-MSFT avatar image
0 Votes"
RoyLi-MSFT answered ·

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!


· 6 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I understand "runFullTrust" can always run user account queries, why all "KnownUserProperties" are empties ?


0 Votes 0 ·

Well, my teammate can't reproduce this and neither other team's engineers. He had replied to you there Please check that.

0 Votes 0 ·

I tried with other computer, same problem, all "KnownUserProperties" are empties.


0 Votes 0 ·

Please check the reply from my teammate.

0 Votes 0 ·

It's not the same question, this thread is about "runFullTrust" and on Stack Overflow is about <uap:Capability Name="userAccountInformation">


0 Votes 0 ·

Yes, we found this issue on our side. We are asking other engineers about this issue to confirm if this is unexpected.

0 Votes 0 ·