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

Update to Avalonia 11.0.0-preview6 #282

Merged
merged 2 commits into from
Mar 30, 2023

Conversation

Numpsy
Copy link
Collaborator

@Numpsy Numpsy commented Mar 15, 2023

The thread at AvaloniaUI/Avalonia#10653 (reply in thread) says there is a new preview release coming soon, and of course there are more breaking changes in the current nightly builds, so changes ho..

The changes are mainly flyout related stuff due to the change at AvaloniaUI/Avalonia#10492

There are also a few WASM changes due to the startup functions having been changed.

Note; The WASM control catalog builds with this change for me, but I get a stack overflow in the browser when I run it - I don't know ATM if that's just something missing over here, or something is wrong in the nightly builds

task {
do! AppBuilder.Configure<App>()
.UseReactiveUI()
.StartBlazorAppAsync()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The WASM startup functions in Avalonia have been made async, and i'm not sure what the best way of handling those is (it currently just ignores the created task like the previous code did)

@JaggerJo
Copy link
Member

@Numpsy nice! Do you mind if we postpone merging this until it's in a preview instead of nightly?

@Numpsy
Copy link
Collaborator Author

Numpsy commented Mar 15, 2023

That's one of the reasons why it's a draft :-)

Actually, I see another pending change at AvaloniaUI/Avalonia#10664 that renames some more things, so best to let that settle anyway I think

@JaggerJo
Copy link
Member

Yeah, guess it makes sense to wait this out :D btw. I've sent you an email.

@Numpsy
Copy link
Collaborator Author

Numpsy commented Mar 15, 2023

It looks like the stack overflow I was getting is an Avalonia bug introduced since the last preview release - AvaloniaUI/Avalonia#10675

@Numpsy
Copy link
Collaborator Author

Numpsy commented Mar 20, 2023

A note / question on the change to ItemsControl.dataItems -

The Avalonia changes at
AvaloniaUI/Avalonia#10590
AvaloniaUI/Avalonia#10604

Have

  1. Added an ItemsSource property to ItemsControl
  2. Changed ItemsControl.Items from an IEnumerable to IList

Based on the doc comments in those changes:
image
I changed dataItems to bind to ItemsSource rather than changing the type of the property to IList.

That has mostly got the control catalog working, except for the tree view sample, which fails at runtime with

An unhandled exception of type 'System.ArgumentException' occurred in Avalonia.Base.dll
Invalid value for Property 'Items': '[{ Name = "Fruit"
  Children = [{ Name = "Tomato"
                Children = [] }; { Name = "Apple"
                                   Children = [] }] }; { Name = "Vegetables"
  Children = [{ Name = "Carrot"
                Children = [] }; { Name = "Salad"
                                   Children = [] }] }]' (Microsoft.FSharp.Collections.FSharpList`1[[Avalonia.FuncUI.ControlCatalog.Views.TreeViewDemo+Taxonomy, Avalonia.FuncUI.ControlCatalog, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])

As it appears that something is trying to convert the provided IEnumerable (which is an FSharpList) to an IList (it works if the Children collections in the sample are arrays instead of lists, and the root collection being a list seems to just work).

I'm not sure if this is a bug somewhere else, or just something in the way that something is populating the 'Items' collection in the child treeview nodes, but it makes me wonder if the itemsSelector part of DataTemplateView might need to be an IList instead of a seq ?

@JaggerJo
Copy link
Member

Good questions. Need to take a deeper look myself.

@Numpsy
Copy link
Collaborator Author

Numpsy commented Mar 21, 2023

Updated to the Avalonia 11.0.0-preview6 release build.

The web assembly bits seem to have been fixed now.

@Numpsy Numpsy changed the title Update for latest Avalonia 11 changes Mar 21, 2023
@Numpsy
Copy link
Collaborator Author

Numpsy commented Mar 24, 2023

I'm not sure if this is a bug somewhere else, or just something in the way that something is populating the 'Items' collection in the child treeview nodes

Here maybe?

https://github.com/AvaloniaUI/Avalonia/blob/9232e82e490e10d904e1388a488643eb4faf2ebc/src/Avalonia.Controls/Primitives/HeaderedItemsControl.cs#L127

@Numpsy
Copy link
Collaborator Author

Numpsy commented Mar 29, 2023

So, I'd been looking at that items control code I linked and wondering if it should bind to ItemsSource rather than Items, and now I see a PR at AvaloniaUI/Avalonia#10827 that does just that (though it also makes the Items property read only, so I'm sure that will break something else).

Anyway, for the Avalonia preview 6 release all my stuff seems to work with this PR as long as I only return ILists from my tree template code, and it doesn't look like we'd want to change the public FuncUI interface to an IList now if IEnumerable will work again later... so - what's the best way to proceed with the other changes?

@JaggerJo JaggerJo marked this pull request as ready for review March 29, 2023 10:10
Copy link
Member

@JaggerJo JaggerJo left a comment

Choose a reason for hiding this comment

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

LGTM, feel free to bump the version and merge.

@Numpsy
Copy link
Collaborator Author

Numpsy commented Mar 30, 2023

Version updated (I don't have the ability to merge)

@JaggerJo JaggerJo merged commit 332247c into fsprojects:master Mar 30, 2023
@Numpsy Numpsy deleted the rw/avalon_nights_6 branch March 30, 2023 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants