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

All source generators fail with nested types that are not classes #210

Closed
1 of 4 tasks
Sergio0694 opened this issue Apr 11, 2022 · 0 comments · Fixed by #211
Closed
1 of 4 tasks

All source generators fail with nested types that are not classes #210

Sergio0694 opened this issue Apr 11, 2022 · 0 comments · Fixed by #211
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit next preview ✈️ This changes will be available in the upcoming preview priority 🚩 An issue or change that has priority

Comments

@Sergio0694
Copy link
Member

Sergio0694 commented Apr 11, 2022

Describe the bug

The source generator only assumes nested types will all be classes.
It should instead track the type of each nested type, and correclty generate that.

Regression

No, always been broken

Steps to reproduce

Paste the following snippet:

public partial class MyClass
{
    public partial struct NestedStructType
    {
        public partial interface NestedInterfaceType
        {
            [ObservableRecipient]
            public partial class MyViewModel : ObservableValidator
            {
                [ObservableProperty]
                [Required]
                private string? name;

                [ICommand]
                private void MyCommand()
                {
                }
            }
        }
    }
}

This results in the following code:

partial class MyClass
{
    partial class NestedStructType
    {
        partial class NestedInterfaceType
        {
            partial class MyViewModel
            {
                // Code here...
            }
        }
    }
}

Expected behavior

The generated code would use the appropriate type for each nested type.

IDE and version

VS 2022

IDE version

17.1

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

main

@Sergio0694 Sergio0694 added bug 🐛 An unexpected issue that highlights incorrect behavior next preview ✈️ This changes will be available in the upcoming preview priority 🚩 An issue or change that has priority mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit labels Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit next preview ✈️ This changes will be available in the upcoming preview priority 🚩 An issue or change that has priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant