dotnet icon indicating copy to clipboard operation
dotnet copied to clipboard

Adding property using [ObservableProperty] breaks hot reload

Open nickrandolph opened this issue 1 year ago • 5 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 image

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

nickrandolph avatar Apr 08 '24 06:04 nickrandolph

Mmh this seems like an external issue. @sharwell do you think this is some VS/Roslyn issue? Have you seen it before? 🤔

Sergio0694 avatar Apr 08 '24 16:04 Sergio0694

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.

sharwell avatar Apr 08 '24 16:04 sharwell

@nickrandolph can you help with that? Feel free to share a link to the VS issue here for reference. Thank you!

Sergio0694 avatar Apr 08 '24 16:04 Sergio0694

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.

forensicmike avatar Apr 28 '24 12:04 forensicmike

apoloiges for the delay, will try to get repro this week

nickrandolph avatar May 15 '24 12:05 nickrandolph