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

Forwarded attributes can crash generator when accessing invalid members #683

Closed
Sergio0694 opened this issue May 7, 2023 · 0 comments · Fixed by #684
Closed

Forwarded attributes can crash generator when accessing invalid members #683

Sergio0694 opened this issue May 7, 2023 · 0 comments · Fixed by #684
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit

Comments

@Sergio0694
Copy link
Member

Sergio0694 commented May 7, 2023

Describe the bug

The forwarded attribute logic (for both observable properties and relay commands) can crash the generator in some invalid scenarios. We should instead emit a proper diagnostic and gracefully skip the current attribute, rather than crashing the generator.

Steps to reproduce

public partial class Foo : ObservableObject
{
    [ObservableProperty]
    [property: Test(TestAttribute.M)]
    private int number;
}

public class TestAttribute : Attribute
{
    public static string M => "";
}

Expected behavior

This should skip the attribute and generate a diagnostic.

@Sergio0694 Sergio0694 added bug 🐛 An unexpected issue that highlights incorrect behavior mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit labels May 7, 2023
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
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant