Adding property using [ObservableProperty] breaks hot reload
nickrandolph opened this issue · comments
Describe the bug
Run application
Add viewmodel class and save changes (triggering hot reload) eg
internal partial class MainViewModel : ObservableObject
{
}
Add properties and save changes (attempting to trigger hot reload) eg
[ObservableProperty]
private int _count = 0;
[ObservableProperty]
private int _step = 1;
This raises a hot reload error
Regression
No response
Steps to reproduce
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
Mmh this seems like an external issue. @sharwell do you think this is some VS/Roslyn issue? Have you seen it before? 🤔
I haven't seen that before and I can't find any other feedback with that message. A performance recording using the Report a Problem feature should collect the information necessary to find the source of the exception.
@nickrandolph can you help with that? Feel free to share a link to the VS issue here for reference. Thank you!
FWIW, I've never successfully been able to add a RelayCommand or ObservableProperty w/ hot reload and MVVM toolkit / source generators. I seem to do more and more of my development with running processes so it's the source of some consternation.
apoloiges for the delay, will try to get repro this week