Skip to content

Fix creating fields for attached properties called name. closes #12283 #12294

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

Merged

Conversation

Mrxx99
Copy link
Contributor

@Mrxx99 Mrxx99 commented Jul 23, 2023

What does the pull request do?

This fixes the issue that the Avalonia.Generators is creating fields for attached proerties that have the name "Name"

What is the current behavior?

A field is created for attached properties called "Name", leading to compile errors, if they contain characters not valid for field names like spaces. A common use case for this is the AutomationProperties.Name. (#12283)

What is the updated/expected behavior with this PR?

No field is generated for attached properties with name "Name"

How was the solution implemented (if it's not obvious)?

Filtering out attached properties in XamlNameResolver by checking if DeclaringType is different to TargetType.

Checklist

Breaking changes

Technical yes, if users would have relied on a wrongly generated field, but I would say that is rather unlikely and is easily fixable by the user.

Obsoletions / Deprecations

none

Fixed issues

Fixes #12283

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038030-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 enabled auto-merge July 23, 2023 23:01
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038036-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 disabled auto-merge July 24, 2023 06:18
@maxkatz6 maxkatz6 enabled auto-merge July 24, 2023 06:18
@Mrxx99
Copy link
Contributor Author

Mrxx99 commented Jul 24, 2023

@maxkatz6 Any idea why integration tests are failing? Seems winappdrive had some connection issues, can these be re-triggered?

@timunie
Copy link
Contributor

timunie commented Jul 25, 2023

@Mrxx99 sometimes they fail for no reason obvious. Merge master to trigger build again.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038072-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Jul 25, 2023
Merged via the queue into AvaloniaUI:master with commit 758c77f Jul 25, 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.

[Generator] "Name" attached property tries to generate field
4 participants