Open
Description
Describe the bug
Upon using the SystemInformation class, the following exception is thrown in unpackaged Windows App SDK projects:
- Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:
Steps to Reproduce
- Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)
Steps to reproduce the behavior:
- Create a new Blank Windows App SDK app (Packaged)
- Perform the required modifications to the project so it runs unpackaged (https://aka.ms/winui3/unpackaged-apps)
- Add the following code in mainwindow.xaml.cs:
private void myButton_Click(object sender, RoutedEventArgs e)
{
myButton.Content = "Clicked";
SystemInformation info = SystemInformation.Instance;
}
- Install the Windows App SDK runtime if not already installed (https://aka.ms/windowsappsdk/1.0-preview3/msix-installer)
- Start the application
- Click on the button
- The call to SystemInformation.Instance fails
Expected behavior
SystemInformation.Instance doesn't fail and provides a subset of the values that are available without a package identity, or if not possible, throws a more friendly exception.
Environment
NuGet Package(s):
- CommunityToolkit.WinUI.UI.Controls
- Microsoft.WindowsAppSDK (1.0.0-preview3)
- Microsoft.Windows.SDK.BuildTools (10.0.20348.19)
Package Version(s):
7.1.1-preview3
Windows 10 Build Number:
- Fall Creators Update (16299)
- April 2018 Update (17134)
- October 2018 Update (17763)
- May 2019 Update (18362)
- May 2020 Update (19041)
- Insider Build (22000.282)
App min and target version:
- Fall Creators Update (16299)
- April 2018 Update (17134)
- October 2018 Update (17763)
- May 2019 Update (18362)
- May 2020 Update (19041)
Device form factor:
- Desktop
- Xbox
- Surface Hub
- IoT
Visual Studio version:
- 2022 (17.Preview/17.0.0-pre.7.0+31825.309)