microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.78k stars 319 forks source link

Errors with multiple appExtensions for widgets #4569

Open michalleptuch opened 2 months ago

michalleptuch commented 2 months ago

Describe the bug

Hello, I noticed that Dev Home app has a few groups of widgets in Widgets boards. You need to install extensions to enable more widgets.

image

I wanted to create similar solution and put everything in one solution without creating extensions for my app, so I declared more appExtensions with different Ids and widget definition ids:

<uap3:Extension Category="windows.appExtension">
  <uap3:AppExtension Name="com.microsoft.windows.widgets" DisplayName="CsConsoleWidgetProvider" Id="winappsdk.cs.console.sample" PublicFolder="Public">
    <uap3:Properties>
      <WidgetProvider>
        <ProviderIcons>
          <Icon Path="Assets\StoreLogo.png" />
        </ProviderIcons>
        <Activation>
          <!-- Apps exports COM interface which implements IWidgetProvider -->
          <CreateInstance ClassId="80DAE84C-DE3C-4F02-8ECD-DCDD1CDECC15" />
        </Activation>

        <Definitions>
          <Definition Id="CSharp_Counting_Widget"
            DisplayName="Sample Counting Widget (C#)"
            Description="Counting Widget Description (C#)">
            <Capabilities>
              <Capability>
                <Size Name="small" />
              </Capability>
              <Capability>
                <Size Name="medium" />
              </Capability>
              <Capability>
                <Size Name="large" />
              </Capability>
            </Capabilities>
            <ThemeResources>
              <Icons>
                <Icon Path="ProviderAssets\Counting_Icon.png" />
              </Icons>
              <Screenshots>
                <Screenshot Path="ProviderAssets\Counting_Screenshot.png" DisplayAltText="For accessibility" />
              </Screenshots>
              <!-- DarkMode and LightMode are optional -->
              <DarkMode />
              <LightMode />
            </ThemeResources>
          </Definition>
          <Definition Id="CSharp_Weather_Widget"
            DisplayName="Sample Weather Widget (C#)"
            Description="Weather Widget Description (C#)">
            <Capabilities>
              <Capability>
                <Size Name="medium" />
              </Capability>
              <Capability>
                <Size Name="large" />
              </Capability>
            </Capabilities>
            <ThemeResources>
              <Icons>
                <Icon Path="ProviderAssets\Weather_Icon.png" />
              </Icons>
              <Screenshots>
                <Screenshot Path="ProviderAssets\Weather_Screenshot.png" DisplayAltText="For accessibility" />
              </Screenshots>
              <!-- DarkMode and LightMode are optional -->
              <DarkMode />
              <LightMode />
            </ThemeResources>
          </Definition>
        </Definitions>
      </WidgetProvider>
    </uap3:Properties>
  </uap3:AppExtension>
</uap3:Extension>

<uap3:Extension Category="windows.appExtension">
  <uap3:AppExtension Name="com.microsoft.windows.widgets" DisplayName="CsConsoleWidgetProvider2" Id="winappsdk.cs.console.sample2" PublicFolder="Public">
    <uap3:Properties>
      <WidgetProvider>
        <ProviderIcons>
          <Icon Path="Assets\StoreLogo.png" />
        </ProviderIcons>
        <Activation>
...
image

It compiles correctly without any manifest validation errors, and I can see all declared extensions as groups of widgets in the widget picker. However, there seems to be an issue. Is there a limit to the number of such extensions in the package manifest? I encounter errors when I add more than 3-5 appExtensions. Sometimes, the widgets board fails to load widgets. The second error occurs when I add a few widgets, close the board, and then reopen it. Instead of pinned widgets, I only see this message:

image

I modified official sample (https://github.com/microsoft/windowsappsdk-samples/tree/main/Samples/Widgets) and attached it below. You also can see my errors here: YouTube

cs-console-packaged.zip

Steps to reproduce the bug

  1. Debug attached solution
  2. Pin a few widgets from solution to the Widgets board
  3. Hide and show board again

Expected behavior

No response

Screenshots

No response

NuGet package version

Windows App SDK 1.5.5: 1.5.240627000

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

Tested on following versions of MicrosoftWindows.Client.WebExperience:

michalleptuch commented 1 month ago

Hello, is there any ETA for this issue? If it's not a prioritized area, just let me know. I don't want to waste my time implementing something that will never work :(