Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommunityTookit controls conflicts with WindowsAppSDK 1.5 control #365

Open
8 of 24 tasks
efreykongcn opened this issue Mar 10, 2024 · 9 comments
Open
8 of 24 tasks

Comments

@efreykongcn
Copy link

efreykongcn commented Mar 10, 2024

Describe the bug

I have an WinUI project which using CommunityToolkit controls (SettingsControls etc.)
After upgrade the WindowsAppSDK to 1.5, and using Selectorbar control in a new page, run app and visit the new page, the app throws Microsoft.UI.Xaml.Markup.XamlParseException with error message The text associated with this error code could not be found. Cannot find a Resource with the Name/Key .

If I remove the CommunityToolkit reference, the SelectorBar page can be displayed correctly.

Steps to reproduce

* Creates a new empty WinUI3 project by Visual Studio 2022

* Open Nuget Package Manager, installs CommunityToolkit.WinUI.Controls.SettingsControls, and Upgrades WindowsAppSDK to 1.5
* In `App.xaml`, add `XamlControlsResources`. 
* In `ManWindow.xaml`, add a new WindowsAppSDK control `SelectorBar`. 
* Runs the project, the app throws `XamlParseException` Exception.

Below is full content of App.xaml file:

<?xml version="1.0" encoding="utf-8"?>
<Application
    x:Class="CommunityToolkitBugReproduce.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CommunityToolkitBugReproduce">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Below is the full content of MainWindow.xaml file:

<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="CommunityToolkitBugReproduce.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <SelectorBar x:Name="SelectorBar2" >
            <SelectorBarItem x:Name="SelectorBarItemPage1" Text="Page1" IsSelected="True" />
            <SelectorBarItem x:Name="SelectorBarItemPage2" Text="Page2" />
            <SelectorBarItem x:Name="SelectorBarItemPage3" Text="Page3" />
        </SelectorBar>
        <Frame x:Name="ContentFrame" IsNavigationStackEnabled="False" />
    </Grid>
</Window>
  • Below is the exception message:
The text associated with this error code could not be found.

Failed to assign to property 'Microsoft.UI.Xaml.Controls.ItemsRepeater.ItemTransitionProvider'. [Line: 0 Position: 0]

Expected behavior

App should display the page with selectorbar control.

Screenshots

Screenshot 2024-03-12 232902

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 10 21H2 (Build 19044)
  • Windows 10 22H2 (Build 19045)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Windows 10, version 2104 (Build 20348)
  • Windows 11, version 22H2 (Build 22000)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

2022

Visual Studio Build Number

No response

Device form factor

Desktop

Additional context

There is a similar issue on Microsoft WinUI repo: microsoft/microsoft-ui-xaml#8810.

Help us help you

Yes, I'd like to be assigned to work on this item.

@insomniachi
Copy link

Exception says cannot find resource TabViewButtonBackground, don't know why SelectorBar needs TabViewButtonBackground.
post full XAML for MainWindow

@efreykongcn
Copy link
Author

I've updated the bug comment with full xaml file content for MainWnidow and App, and corrected the snapshot. @insomniachi

@michael-hawker
Copy link
Member

@efreykongcn 8.0 wasn't built against 1.5, it's the same issue was you found in the WinUI repo.

If you look at our https://aka.ms/wct/wiki/previewpackages latest feed, they now build against 1.5 and should work.

@Arlodotexe
Copy link
Member

Arlodotexe commented Apr 4, 2024

Like @michael-hawker said. The preview packages for 8.1 should have what you need, let us know if they fix the issue for you @efreykongcn!

@efreykongcn
Copy link
Author

I followed the Preview Packages instructions and updated communitytoolkit packages (SettingsControls and TokenizingTextBox) to 1.0.0 (published on 2/27/2024) , and then build and run the test app, it works as expected. So I think this release does fix the issue.

Screenshot 2024-04-07 104108

@michael-hawker @Arlodotexe

@Arlodotexe
Copy link
Member

@efreykongcn Here's the issues I can see in your screenshot:

  • The package source in your NuGet Package Explorer is set to "Windows Community Toolkit Labs", and should be set to "All" or "nuget.org".
  • The URL for the "Windows Community Toolkit Labs" is set to the PullRequests feed, not the labs feed. There shouldn't be a 1.0.0 package, this is in the PullRequest feed from an erroneous PR and will eventually get cleaned up.

@efreykongcn
Copy link
Author

@Arlodotexe Thanks for your reply, here's my notes:

Issue 1 NuGet Package Explorer is set to "Windows Community Toolkit Labs"
-- This is just to filter the preview packages.

Issue 2, The URL for the "Windows Community Toolkit Labs" is set to the PullRequests feed, not the labs feed

-- I added the labs feed at the first time, but the labs feed doesn't provide any release of preview packages (Pls see the snapshot). I've tried all those 3 sources (Labs, latest, pull requests), only PullRequests feed provides new release of the packages, which published date is 2/27/2024, but version is 1.0.0.

Screenshot 2024-04-09 123059

@michael-hawker
Copy link
Member

@efreykongcn see https://aka.ms/wct/wiki/previewpackages for more info, but sounds like you're looking for the MainLatest feed: https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-MainLatest/nuget/v3/index.json

That'll have the latest builds from our main branch. The Settings Controls were moved out of Labs a while ago before we shipped 8.0 even.

Though we recently shipped previews on NuGet itself in preparation for our 8.1 release (for that you need to check the 'include prerelease' checkbox next to the search box to see them).

@Arlodotexe maybe we should list the Latest feed first in the wiki? Can also call out the Nuget checkbox too. And also, maybe add details about the version numbers, breakdown of the date format and also how the build number corresponds to the action run number and such? (Similarly for the PR one we could break down the PR number that's included, and remove the Nerdbank info as we don't use that anymore.)

@efreykongcn
Copy link
Author

@michael-hawker Thanks a lot. I just updated the package to 8.1.240328-rc from nuget.org source, it satisfied my requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants