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

Only one static constructor is generated when multiple types with same DependencyPropertyAttribute in the same file #50

Closed
noliar opened this issue Jul 17, 2024 · 0 comments · Fixed by #51
Labels
bug Something isn't working

Comments

@noliar
Copy link
Contributor

noliar commented Jul 17, 2024

Describe the bug

There are several types with DependencyPropertyAttribute in MainWindow.cs:

[DependencyProperty<bool>("IsSpinning", DefaultValue = true, Category = "Category", Description = "Description")]
public partial class MyControl : UserControl
{
public bool IsChanged { get; private set; }
// Optional
partial void OnIsSpinningChanged(bool oldValue, bool newValue)
{
IsChanged = true;
}
}

[DependencyProperty<string>("Text")]
[DesignTimeVisible(false)]
public partial class Generatable : Control
{
partial void OnTextChanged(string? oldValue, string? newValue)
{
}
}

  1. add <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> to DependencyPropertyGenerator.IntegrationTests.csproj project
  2. build
  3. open H.Generators.StaticConstructorGenerator folder

image

there's no H.Generators.IntegrationTests.Generatable.StaticConstructor.g.cs file

Steps to reproduce the bug

  1. add <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> to DependencyPropertyGenerator.IntegrationTests.csproj project
  2. build
  3. open H.Generators.StaticConstructorGenerator folder

Expected behavior

generated H.Generators.IntegrationTests.Generatable.StaticConstructor.g.cs file correctly.
All static constructor should be generated correctly when multiple types with same DependencyPropertyAttribute in one file

Screenshots

image

NuGet package version

No response

IDE

No response

Additional context

No response

@noliar noliar added the bug Something isn't working label Jul 17, 2024
@noliar noliar mentioned this issue Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant