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

Porting Primitives #18

Merged
merged 20 commits into from
Apr 20, 2023
Merged

Porting Primitives #18

merged 20 commits into from
Apr 20, 2023

Conversation

niels9001
Copy link
Collaborator

@niels9001 niels9001 commented Apr 13, 2023

For #8

Known issues:

WrapPanel sample

  • Binding with settings panel in ItemsPanelTemplate doesn't work.

UniformGrid sample

  • Binding with settings panel does not work on WASM (due to the XAML casting?)

ContrainedBox sample

  • Brushes not yet ported, so the checkered sample not working.

StaggeredSamples.md

  • Throws an exception.. not sure why?

@michael-hawker
Copy link
Member

@niels9001 some Uno related errors:

"D:\a\Windows\Windows\CommunityToolkit.AllComponents.sln" (default target) (1:2) ->
"D:\a\Windows\Windows\components\Primitives\samples\Primitives.Samples.csproj" (default target) (6:39) ->
"D:\a\Windows\Windows\components\Primitives\samples\Primitives.Samples.csproj" (Build target) (6:51) ->
"D:\a\Windows\Windows\components\Primitives\src\CommunityToolkit.WinUI.Controls.Primitives.csproj" (default target) (7:77) ->
  D:\a\Windows\Windows\components\Primitives\src\StaggeredPanel\StaggeredPanel.cs(10,14): error CS0260: Missing partial modifier on declaration of type 'StaggeredPanel'; another partial declaration of this type exists [D:\a\Windows\Windows\components\Primitives\src\CommunityToolkit.WinUI.Controls.Primitives.csproj]
  D:\a\Windows\Windows\components\Primitives\src\ConstrainedBox\ConstrainedBox.Properties.cs(15,19): error CS0114: 'ConstrainedBox.ScaleX' hides inherited member 'View.ScaleX'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. [D:\a\Windows\Windows\components\Primitives\src\CommunityToolkit.WinUI.Controls.Primitives.csproj]
  D:\a\Windows\Windows\components\Primitives\src\ConstrainedBox\ConstrainedBox.Properties.cs(30,19): error CS0114: 'ConstrainedBox.ScaleY' hides inherited member 'View.ScaleY'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. [D:\a\Windows\Windows\components\Primitives\src\CommunityToolkit.WinUI.Controls.Primitives.csproj]

One should be an easy fix, not sure about the overrides. May want to compare against the Uno fork?

@michael-hawker michael-hawker linked an issue Apr 18, 2023 that may be closed by this pull request
@niels9001 niels9001 marked this pull request as ready for review April 18, 2023 17:04
@michael-hawker
Copy link
Member

@niels9001 what's the exception for staggered? Is it the Panel or the Layout? Is it UWP and/or WASDK?

@michael-hawker
Copy link
Member

WinUI 2 job failed due to .NET Native.

WinUI 3 job is failing due to test?

 Failed LeftCenter [57 ms]
  Error Message:
   Test method PrimitivesExperiment.Tests.Test_ConstrainedBox.Test_ConstrainedBox_Alignment_Aspect threw exception: 
Microsoft.UI.Xaml.Markup.XamlParseException: XAML parsing failed.
  Stack Trace:
      at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
   at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
   at ABI.Microsoft.UI.Xaml.Markup.IXamlReaderStaticsMethods.Load(IObjectReference _obj, String xaml)
   at Microsoft.UI.Xaml.Markup.XamlReader.Load(String xaml)
   at PrimitivesExperiment.Tests.Test_ConstrainedBox.<>c__DisplayClass0_0.<<Test_ConstrainedBox_Alignment_Aspect>b__0>d.MoveNext() in D:\a\Windows\Windows\components\Primitives\tests\Test_ConstrainedBox.Alignment.cs:line 32
--- 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 PrimitivesExperiment.Tests.Test_ConstrainedBox.Test_ConstrainedBox_Alignment_Aspect(String horizontalAlignment, Int32 expectedLeft, String verticalAlignment, Int32 expectedTop) in D:\a\Windows\Windows\components\Primitives\tests\Test_ConstrainedBox.Alignment.cs:line 30
   at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.ThreadOperations.ExecuteWithAbortSafety(Action action)

@Arlodotexe
Copy link
Member

Arlodotexe commented Apr 19, 2023

@niels9001 what's the exception for staggered? Is it the Panel or the Layout? Is it UWP and/or WASDK?

@michael-hawker Got that for you. Here's the relevant parts of the Exception that was thrown (tables pasted from VS)

  Name Value Type
$exception {"Index was outside the bounds of the array."} System.IndexOutOfRangeException
  Name Value Type
  StackTrace " at Microsoft.Toolkit.Parsers.Markdown.Blocks.TableBlock.TableRow.ParseContents(String markdown, Int32 startingPos, Int32 maxEndingPos, Int32 quoteDepth, Boolean requireVerticalBar, Action`2 contentParser)\r\n at Microsoft.Toolkit.Parsers.Markdown.Blocks.TableBlock.TableRow.Parse(String markdown, Int32 startingPos, Int32 maxEndingPos, Int32 quoteDepth)\r\n at Microsoft.Toolkit.Parsers.Markdown.Blocks.TableBlock.Parse(String markdown, Int32 start, Int32 endOfFirstLine, Int32 maxEnd, Int32 quoteDepth, Int32& actualEnd)\r\n at Microsoft.Toolkit.Parsers.Markdown.MarkdownDocument.Parse(String markdown, Int32 start, Int32 end, Int32 quoteDepth, Int32& actualEnd)\r\n at Microsoft.Toolkit.Parsers.Markdown.MarkdownDocument.Parse(String markdownText)\r\n at Microsoft.Toolkit.Uwp.UI.Controls.MarkdownTextBlock.RenderMarkdown()" string
  Name Value Type
TargetSite {Int32 ParseContents(System.String, Int32, Int32, Int32, Boolean, System.Action`2[System.Int32,System.Int32])} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
  Name Value Type
DeclaringType {Name = "TableRow" FullName = "Microsoft.Toolkit.Parsers.Markdown.Blocks.TableBlock+TableRow"} System.Type {System.RuntimeType}

@michael-hawker
Copy link
Member

Thanks @Arlodotexe, that's weird. It looks like an exception in the sample markdown parser itself vs. the panel...

@michael-hawker
Copy link
Member

Discovered Uno has their own WrapPanel implementation, so causes namespace conflicts with ours and how we do global usings. Have a fix in the sample for it now.

Removed some of the markdown from the Staggard page and it seems to be working for me on UWP?

We'll have to add an issue to the tasklist about fixing the bindings for the sample. @Arlodotexe I tried to understand how the generated option binding works and where the property is. Is there not a property value on the page somewhere, did I miss it? Could we do something like {Binding HorizontalSpacing, ElementName=MyPage} and put a name our page at the top of the XAML?

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.

Pushed up fixes, think we'll be in a good enough state for now assuming CI passes.

Did notice the issues with UniformGrid on WASM as well. Otherwise, just WrapPanel binding it seems is the other issue.

Tested on UWP, WinAppSDK, and WASM. Looks good.

@michael-hawker
Copy link
Member

Oops, missed an update in one case of the switch to .Controls in the tests, should be fixed now.

@michael-hawker michael-hawker added this pull request to the merge queue Apr 20, 2023
Merged via the queue into main with commit 13f4f04 Apr 20, 2023
@delete-merged-branch delete-merged-branch bot deleted the port/primitives branch April 20, 2023 04:05
@michael-hawker michael-hawker mentioned this pull request Apr 20, 2023
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

Successfully merging this pull request may close these issues.

Port Primitives
3 participants