Skip to content

SystemInformation helper throws an exception with Unpackaged Windows App SDK projects #4356

Open
@gus33000

Description

@gus33000

Describe the bug

Upon using the SystemInformation class, the following exception is thrown in unpackaged Windows App SDK projects:

image

  • 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:

  1. Create a new Blank Windows App SDK app (Packaged)
  2. Perform the required modifications to the project so it runs unpackaged (https://aka.ms/winui3/unpackaged-apps)
  3. Add the following code in mainwindow.xaml.cs:
        private void myButton_Click(object sender, RoutedEventArgs e)
        {
            myButton.Content = "Clicked";
            SystemInformation info = SystemInformation.Instance;
        }
  1. Install the Windows App SDK runtime if not already installed (https://aka.ms/windowsappsdk/1.0-preview3/msix-installer)
  2. Start the application
  3. Click on the button
  4. 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)

Metadata

Metadata

Assignees

Labels

WinUI 💠Related to WinUI 3 Version or when paired with External can mean requires fix in WinUI 2/3.bug 🐛An unexpected issue that highlights incorrect behaviorhelp wantedIssues identified as good community contribution opportunities

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions