CommunityToolkit / dotnet

.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.

Home Page:https://docs.microsoft.com/dotnet/communitytoolkit/?WT.mc_id=dotnet-0000-bramin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
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

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