Skip to content

[Bug]: Avalonia for VSCode fails to recognize properties generated by CommunityToolkit.Mvvm #121

@DefaultCyberid

Description

@DefaultCyberid

Describe the bug

The Avalonia for VSCode extension is currently unable to resolve properties generated by CommunityToolkit.Mvvm (e.g., properties created via the [ObservableProperty] attribute).

While the project builds and runs successfully without any errors, the VS Code editor displays false-positive red squiggly lines (IntelliSense errors) indicating that these generated properties do not exist in the ViewModel.

To Reproduce

  1. Create project with Avalonia.Mvvm template: dotnet new avalonia.mvvm -o MyAvaloniaApp
  2. Change the Greeting variable in MainWindowViewModel.cs into a generated one:
    [ObservableProperty]
    public string _greeting = "Welcome to Avalonia!";

The {Text="{Binding Greeting}"} in MainWindow.axaml shows error: The property 'Greeting' does not exist on 'MyAvaloniaApp.ViewModels.MainWindowViewModel'.Avalonia(MC3073)

Product(s)

Avalonia for Code

Platform

macOS

License Tier

Community

Avalonia version

12.0.2

Tool/Control Version

12.2.0

Relevant log output

Additional context

No response

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions