CommunityToolkit / CommunityToolkit/dotnet

Adding property using [ObservableProperty] breaks hot reload

Open
#859 10 comments 0 reactions 0 assignees View on GitHub
bug :bug: external :arrow_heading_up: mvvm-toolkit :toolbox: needs author feedback :memo:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

Run application
Add viewmodel class and save changes (triggering hot reload) eg
```csharp
internal partial class MainViewModel : ObservableObject
{
}
```
Add properties and save changes (attempting to trigger hot reload) eg
```csharp
[ObservableProperty]
private int _count = 0;

[ObservableProperty]
private int _step = 1;
```
This raises a hot reload error
![image](https://github.com/CommunityToolkit/dotnet/assets/1614057/6789ce85-9256-4cb0-9308-2f0e6162f3cf)

### Regression

_No response_

### Steps to reproduce

```text
see description
```

### Expected behavior

Hot reload should be successful

### Screenshots

_No response_

### IDE and version

VS 2022

### IDE version

_No response_

### Nuget packages

- [ ] CommunityToolkit.Common
- [ ] CommunityToolkit.Diagnostics
- [ ] CommunityToolkit.HighPerformance
- [ ] CommunityToolkit.Mvvm (aka MVVM Toolkit)

### Nuget package version(s)

8.2.2

### Additional context

_No response_

### Help us help you

No, just wanted to report this

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.