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

🧪 [Experiment] DependencyPropertyGenerator #621

Open
7 tasks done
Sergio0694 opened this issue Dec 7, 2024 · 2 comments
Open
7 tasks done

🧪 [Experiment] DependencyPropertyGenerator #621

Sergio0694 opened this issue Dec 7, 2024 · 2 comments
Labels
experiment 🧪 Used to track issues that are experiments (or their linked discussions)

Comments

@Sergio0694
Copy link
Member

Sergio0694 commented Dec 7, 2024

Note

Originally from #449.

Overview

Tracking issue for the new DependencyProperty generator, for UWP (both .NET Native and .NET 9) and WinUI 3.
This is what using the new generator looks like:

[GeneratedDependencyProperty]
public string? Name { get; set; }

It only supports instance properties. Attached properties are not currently supported.

Remaining task

Here's a few remaining tasks to track work:

  • Codegen for DefaultValueCallback
  • Improve formatting for PropertyMetadata construction
  • Diagnostic for using DefaultValue and DefaultValueCallback at the same time
  • Diagnostic for DefaultValueCallback set to null
  • Diagnostic for DefaultValueCallback not matching an existing method
  • Diagnostic for DefaultValueCallback matching an invalid method (eg. wrong signature)
  • Diagnostic for properties that end with the "Property" suffix
@Sergio0694 Sergio0694 added the experiment 🧪 Used to track issues that are experiments (or their linked discussions) label Dec 7, 2024
@insomniachi
Copy link

insomniachi commented Dec 9, 2024

Why was the name of the attribute changed from DependencyPropertyAttribute to GeneratedDepedencyPropertyAttribute?
it causes some conflict with existing DependencyProperty class?
we don't have the word Generated in ObservablePropertyAttribute

@michael-hawker
Copy link
Member

@insomniachi see the comment here: #617 (comment)

In theory we could name it the same, it wouldn't conflict because it's an attribute. But in general, the convention is to use the "Generated" prefix for attributes triggering generation (eg. see [GeneratedComInterface], GeneratedComClass], [GeneratedRegex], etc.). If anything, it's the attributes in the MVVM Toolkit that are kinda breaking this 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experiment 🧪 Used to track issues that are experiments (or their linked discussions)
Projects
None yet
Development

No branches or pull requests

3 participants