Skip to content

Introduction to the MVVM Toolkit example does not compile #591

@1podProgrammer

Description

@1podProgrammer

Type of issue

Code doesn't work

Description

So here we go again...
public class ViewModelObject : ObservableObject
{
[ObservableProperty]
public int Count = 1;
}
This doesn't work because it throws MVVMTK0045 and MVVMTK0014

public partial class ViewModelObject : ObservableObject
{
[ObservableProperty]
public int Count = 1;
}
This doesn't work because it throws MVVMTK0045 and MVVMTK0014

public partial class ViewModelObject : ObservableObject
{
[ObservableProperty]
public partial int Count = 1;
}
This doesn't work because it throws CS0267 - as code to fix MVVMTK0045 and MVVMTK0014 recommends adding partial to a property.

What works?
Any guesses...

Page URL

https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/generators/errors/mvvmtk0045

Content source URL

https://github.com/MicrosoftDocs/CommunityToolkit/blob/main/docs/mvvm/generators/errors/MVVMTK0045.md

Document Version Independent Id

e5623fb0-a53a-1164-b4d2-6f81bb38d041

Platform Id

cb1c87d2-610f-30a6-37c6-ecd053cb3b68

Article author

@Sergio0694

Metadata

  • ID: e5623fb0-a53a-1164-b4d2-6f81bb38d041
  • PlatformId: cb1c87d2-610f-30a6-37c6-ecd053cb3b68
  • Service: dotnet-communitytoolkit
  • Sub-service: mvvm-toolkit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions