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

[MVUX] Update Bindable Generator Attribute Naming #2515

Open
6 tasks
ajpinedam opened this issue Aug 20, 2024 · 12 comments
Open
6 tasks

[MVUX] Update Bindable Generator Attribute Naming #2515

ajpinedam opened this issue Aug 20, 2024 · 12 comments
Assignees
Labels
kind/enhancement New feature or request. triage/untriaged Indicates an issue requires triaging or verification.

Comments

@ajpinedam
Copy link
Contributor

What would you like to be added:

Rename the Bindable Generator Attribute to something more generic, especially now that this is not generating BindableModels anymore but instead it is generating ViewModels

Why is this needed:

For which Platform:

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renders for Xamarin.Forms
  • Windows
  • Build tasks

Anything else we need to know?

@ajpinedam ajpinedam added kind/enhancement New feature or request. triage/untriaged Indicates an issue requires triaging or verification. labels Aug 20, 2024
@ajpinedam ajpinedam self-assigned this Aug 20, 2024
@dr1rrb
Copy link
Member

dr1rrb commented Aug 20, 2024

Considering that the BindableAttribute is the attribute used by windows to flag object that should be accessible to the binding engine, I would not introduce a breaking change to rename those attributes.

@francoistanguay
Copy link
Contributor

Didnt realize BindableGenerator was "associated" to the BindableAttribute idea. Happy to keep it as-is for now.

@DevTKSS
Copy link

DevTKSS commented Dec 12, 2024

My compiler is also telling that on each viewModel the Bindable attribute is missing although the mainmodel and MainPage having it added by me

@ajpinedam
Copy link
Contributor Author

Hi @DevTKSS, I'm sorry, but I don't quite understand your previous comment. What error are you receiving?

Please also provide more information about the Uno version you are using and, if possible, attach some ways to reproduce the error. I would appreciate it.

@DevTKSS
Copy link

DevTKSS commented Dec 12, 2024

@ajpinedam
The Bindable attribute is missing and the type [UnoHotDesignApp1.Presentation.MainViewModel] is not known by the MetadataProvider. Reflection was used instead of the binding engine and generated static metadata. Add the Bindable attribute to prevent this message and performance issues.

that is happening on mvux, where I essentially can not even add the BindableAttribuge it is telling me to do. if we would be able to get the generator add this attribute, that maybe could solve this....

@Mike-E-angelo
Copy link

I am seeing the same messages that @DevTKSS is seeing as well:

The Bindable attribute is missing and the type [<Root>.Application.Presentation.MainPage] is not known by the MetadataProvider. Reflection was used instead of the binding engine and generated static metadata. Add the Bindable attribute to prevent this message and performance issues.
The Bindable attribute is missing and the type [<Root>.Application.Presentation.MainViewModel] is not known by the MetadataProvider. Reflection was used instead of the binding engine and generated static metadata. Add the Bindable attribute to prevent this message and performance issues.

@dr1rrb
Copy link
Member

dr1rrb commented Dec 18, 2024

@DevTKSS @Mike-E-angelo We are already adding a [BindableAttribute] on VM generated by MVUX which then should be considered by the bindable type provider generator. So it seems to indicate that we have another bigger issue. On which platform do you get those error messages?

Also @Mike-E-angelo it's surprising that you also get this message for the MainPage. If it inherits from a DepndencyObject the attribute should be set transitively (as it's been set on DependencyObject by uno). What is the base type of your MainPage?

@Mike-E-angelo
Copy link

Hi @dr1rrb I am seeing this on net9.0-desktop (the only platform I am trying right now). Additionally MainPage is a basic Microsoft.UI.Xaml.Controls.Page, Uno.UI page. 🤔

@DevTKSS
Copy link

DevTKSS commented Dec 18, 2024

@dr1rrb would have to check if its .net 8 or 9 but i am absolutely sure my current one is desktop only target because I am doing studio stuff where i had the issue before with a additional Windows target its really slow and way more buggy.
But the Bindableattribute related issue is happening at build even before i could even try to enter Studio.
I did get the issue Before (about sdk version 43 or so?) @Mike-E-angelo did tell about with the Mainpage also not having this attribute. It told it to be mainModel, mainPage and in that case not mentioning the viewModel 😅 when i added this attribute above the class it has been fine, only issue has been then also, the x:Bind to not working with mvux what I would have seen as the big advantage ob mvux to mvvm, and this would be (to me) a good reason to maybe also learn mvvm in the future.
In the application where this stopped i think i had been using desktop, android, ios, windows... You could look into my GitHub repos like the "MyUnoXamlApp" or similar named. Each of them is having issues why i did not continue to work on them. Not got mvux in my head then, starting with navigation which I currently carefully maybe have running in my current application.
But the downside, the last studio using application I committed and pushed to GitHub is after cloning to my local device not longer nicly running. Its hell to work with it. Laggy +1000%, login issue und studio not longer showing up (it did before!)
So for that reason I am currently porting the app comtent to the new one which is only targeting desktop and running smoothly. Okay with minor laggyness but way less than at the best time of the +windows one!

@Mike-E-angelo
Copy link

Mike-E-angelo commented Dec 19, 2024

So I am noticing one of the warnings go away when I update my code-behind from this:

public sealed partial class MainPage // <-- Warning
{
	public MainPage()
	{
		InitializeComponent();
	}
}

To this:

public sealed partial class MainPage : Page // <-- No Warning
{
	public MainPage()
	{
		InitializeComponent();
	}
}

@dr1rrb
Copy link
Member

dr1rrb commented Dec 19, 2024

Ok so if both of you are getting this issue on desktop target, it means it's definitely linked to one of our generators (MVUX or Uno)

But this is interesting :

So I am noticing one of the warnings go away when I update my code-behind from this: [../..]

cc. @jeromelaban

It means that it's probably only that MVUX's [Bindable] is not considered by the generator ... or it's generated too late! Opened a new issue for that #2648 (as it's not linked to the original issue).

@Youssef1313
Copy link
Member

@dr1rrb This behavior is expected. #2648 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request. triage/untriaged Indicates an issue requires triaging or verification.
Projects
None yet
Development

No branches or pull requests

6 participants