Skip to content

Conversation

@niels9001
Copy link
Collaborator

@niels9001 niels9001 commented Jul 13, 2023

  • Adding a few new samples for various converters. (No sample for e.g. TaskResultConverter and ResourceStringConverter as these might not be used that much?) Maybe a code 1 liner is enough?

Known issues:

  • The EmptyCollection converter sample does not seem to work.. Converter doesn't get triggered when the collection changes?
  • ColorToDisplayName sample not working for WASDK

@michael-hawker Would love to get your feedback on these samples - wanted to keep them as simple as possible to let devs quickly copy-and-paste what they need vs. complex use cases - especially since Converters are pretty straightforward to work with?

@michael-hawker
Copy link
Member

Weird different test failure:

 Failed Test_RichSuggestBox_AddTokens (@Token1,@Token2,@Token3) [142 ms]
  Error Message:
   Assert.IsTrue failed. SuggestionChosen was not invoked.
  Stack Trace:
     at RichSuggestBoxExperiment.Tests.Test_RichSuggestBox.TestAddTokenAsync(RichSuggestBox rsb, String tokenText) in D:\a\Windows\Windows\components\RichSuggestBox\tests\Test_RichSuggestBox.cs:line 354
   at RichSuggestBoxExperiment.Tests.Test_RichSuggestBox.<>c__DisplayClass0_0.<<Test_RichSuggestBox_AddTokens>b__0>d.MoveNext() in D:\a\Windows\Windows\components\RichSuggestBox\tests\Test_RichSuggestBox.cs:line 33
--- End of stack trace from previous location ---
   at CommunityToolkit.WinUI.DispatcherQueueExtensions.<>c__DisplayClass3_0.<<EnqueueAsync>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at RichSuggestBoxExperiment.Tests.Test_RichSuggestBox.Test_RichSuggestBox_AddTokens(String tokenText1, String tokenText2, String tokenText3) in D:\a\Windows\Windows\components\RichSuggestBox\tests\Test_RichSuggestBox.cs:line 26
   at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.ThreadOperations.ExecuteWithAbortSafety(Action action)

Reran job

@michael-hawker
Copy link
Member

@niels9001 realizing that the color converter directly throwing an exception on WASDK is going to mean we can't load any of the samples on this page in our sample app as it just takes down the app. That's not really good... 😋

@ChaseKnowlden
Copy link

I'm watching @michael-hawker's stream.

@michael-hawker
Copy link
Member

@niels9001 for the EmptyCollectionToObjectConverter base class it's not dynamic, it only cares about the initial state. Otherwise it'd need to listen to the INotifyCollectionChanged interface on the collection, but that sort of connection isn't something a converter is meant to do. It's really meant for a page that initializes a collection based on some result and not for a dynamic collection.

We should update the comments on the classes and the documentation here as such.

For the dynamic scenario the IsNullOrEmptyStateTrigger is probably going to be the way to go? So, we should call that out here?

Though another solution may be able to be an x:Bind function that takes the Items.Count? As I think that should respond to changes...

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @niels9001 great job, love the micro samples. They're looking really good!

Have a few comments for improvements/nits and additions for a couple of missing ones. Also think I addressed your comments, and I have some fixes for some bugs I'm pushing to the tooling submodule, as I had issues testing/trying some things out.

@michael-hawker
Copy link
Member

Opened CommunityToolkit/Tooling-Windows-Submodule#99 to fix the issue with the Converter reference which prevents modifying the converter code and testing it in the repo (as the Sample app instead always pulls from the NuGet package code instead of the local source).

@niels9001
Copy link
Collaborator Author

Opened CommunityToolkit/Tooling-Windows-Submodule#99 to fix the issue with the Converter reference which prevents modifying the converter code and testing it in the repo (as the Sample app instead always pulls from the NuGet package code instead of the local source).

Aah, good catch :-)! Yes, let's get that merged in so we can validate the change to the ColorToDisplayNameConverter.

I think I addressed most of the feedback - let me know what you think!

@michael-hawker michael-hawker linked an issue Jul 18, 2023 that may be closed by this pull request
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested everything. Only things that don't seem to work well are the Color and Type converters on WASM, not sure why... I guess ColorPicker isn't supported on Uno? Not sure what's up with the types though there...

Other than that it's just waiting for WASDK to support the missing API for the Color Converter

@michael-hawker
Copy link
Member

Hmm, conflict with tooling submodule pointer, going to rebase locally...

@michael-hawker michael-hawker force-pushed the niels9001/converters-samples-tests branch from bb42368 to b4e6015 Compare July 18, 2023 20:56
@michael-hawker michael-hawker enabled auto-merge (squash) July 18, 2023 20:56
@michael-hawker
Copy link
Member

Hmmm...

/home/runner/.nuget/packages/msbuild.sdk.extras/3.0.23/Build/Workarounds.targets(27,5): error : If you are building projects that require targets from full MSBuild or MSBuildFrameworkToolsPath, you need to use desktop msbuild ('msbuild.exe') instead of 'dotnet build' or 'dotnet msbuild' [/home/runner/work/Windows/Windows/components/Converters/src/CommunityToolkit.WinUI.Converters.csproj::TargetFramework=uap10.0.17763]
/home/runner/.nuget/packages/microsoft.windowsappsdk/1.3.230331000/buildTransitive/MrtCore.PriGen.targets(911,5): error MSB4062: The "Microsoft.Build.Packaging.Pri.Tasks.ExpandPriContent" task could not be loaded from the assembly /usr/share/dotnet/sdk/7.0.306/Microsoft/VisualStudio/v17.0/AppxPackage/Microsoft.Build.Packaging.Pri.Tasks.dll. Could not load file or assembly '/usr/share/dotnet/sdk/7.0.306/Microsoft/VisualStudio/v17.0/AppxPackage/Microsoft.Build.Packaging.Pri.Tasks.dll'. The system cannot find the file specified. [/home/runner/work/Windows/Windows/components/Converters/src/CommunityToolkit.WinUI.Converters.csproj::TargetFramework=net6.0-windows10.0.19041.0]
/home/runner/.nuget/packages/microsoft.windowsappsdk/1.3.230331000/buildTransitive/MrtCore.PriGen.targets(911,5): error MSB4062:  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [/home/runner/work/Windows/Windows/components/Converters/src/CommunityToolkit.WinUI.Converters.csproj::TargetFramework=net6.0-windows10.0.19041.0]
    356 Warning(s)
    2 Error(s)

@Arlodotexe you see this before?

@michael-hawker
Copy link
Member

Actually probably has to do with the changes to the submodule and the Converters package... we do the same build in the Tooling repo though, but there's more components here... (including the source). Maybe missed something, will investigate locally.

@michael-hawker
Copy link
Member

michael-hawker commented Jul 18, 2023

Hmm, all three heads built fine locally for the generate all solution, so seems something specific to linux build...

@michael-hawker
Copy link
Member

Rerunning the linux build, I tried locally on windows with the same build command and it was fine:

dotnet build /r /bl /p:UnoSourceGeneratorUseGenerationHost=true /p:UnoSourceGeneratorUseGenerationController=false

    373 Warning(s)
    0 Error(s)

Time Elapsed 00:01:28.63

h:\code\CommunityToolkitWindows\tooling\ProjectHeads\AllComponents\Wasm>

@Arlodotexe
Copy link
Member

@michael-hawker
Copy link
Member

This is waiting on #152 which was waiting on #160.

@michael-hawker
Copy link
Member

#152 is good now, so once that's merged we can get this cleaned-up/updated and in!

@michael-hawker michael-hawker force-pushed the niels9001/converters-samples-tests branch from b6081df to 00d36c1 Compare August 2, 2023 23:34
@michael-hawker
Copy link
Member

Rebased on main, should hopefully be good to go once it builds...

@michael-hawker michael-hawker merged commit 2befb11 into main Aug 3, 2023
@delete-merged-branch delete-merged-branch bot deleted the niels9001/converters-samples-tests branch August 3, 2023 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Samples for Converters

5 participants