ReactiveUI 6 Async Command Not Running on Background Thread in WPF app

后端 未结 2 1581
刺人心
刺人心 2021-01-13 21:51

ViewModel

public class MyViewModel:ReactiveObject, IRoutableViewModel{
        private ReactiveList _appExtensions; 

        p         


        
2条回答
  •  忘掉有多难
    2021-01-13 22:43

    Can you show the implementation of _schemaService.GetApplicationExtensions()?

    Depending on how it is implemented it might not actually be on another thread. Arguably, ReactiveCommand should guarantee that even async operations that accidentally burn CPU before running an async op are forced onto background threads, but efficiency is trumping defensive programming in this case.

    You shouldn't need either SubscribeOn or ObserveOn, ReactiveCommand already guarantees that values will be returned on the UI thread. Otherwise, this code is looking good!

提交回复
热议问题