The following code creates an update thread that is supposed to notify the view every 10ms.
DataVM::DataVM()
{
Update = UpdateLoop();
}
IAsyncAction DataVM::UpdateLoop()
{
co_await resume_background();
while ( true )
{
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
RaisePropertyChanged( L"SomeProperty" );
}
}
The issue: Something goes wrong when RaisePropertyChanged
is called and the thread stops. Inspecting the Update
object it shows Status=Error
after RaisePropertyChanged
has been called once. Without the call it keeps running. There is also nothing wrong with my impl of RaisePropertyChanged
, it works as intended in other places.
Questions:
- How do I go about debugging things like this? Where would I see the
Error
occurring? - How do I correctly call
RaisePropertyChanged
so that my code works as intended? - Other/better ways to update on a regular basis? (This one seems pretty easy, though, if only it worked)