title: Task locks UI on a MVVM WPF Project
body: <p>When trying to make a long call on a WPF MVVM project, the interface gets locked during the call. I can't figure out why...</p>
  <p>Here's a exemple:</p>
  <pre><code>public class UIViewModel : ViewModelBaseClass
  {    
  ...
      public ICommand Bt_Search { get; set; }
      
      public UIViewModel 
      {
          Bt_Search = new RelayCommand(o =&gt; Load());
      } 
      ...
  
      ...
      private async Task Load()
      {
           await Task.Run(() =&gt; Thread.Sleep(20000)); //just simulate a long call
      }
      ...
  }
  </code></pre>
  <p>Here is my RelayCommmand Class:</p>
  <pre><code>public class RelayCommand : ICommand
  {
      private Action&lt;object&gt; _action;
  
      public RelayCommand(Action&lt;object&gt; action)
      {
          _action = action;
      }
  
      public bool CanExecute(object parameter)
      {
          return true;
      }
  
      public void Execute(object parameter)
      {
          _action(parameter);
      }
  
      public event EventHandler CanExecuteChanged;
  }
  </code></pre>
  <p>And here my ViewModelBaseClass:</p>
  <pre><code>public abstract class ViewModelBaseClass : INotifyPropertyChanged
  {
      public event PropertyChangedEventHandler PropertyChanged;
  
      protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
      {
          PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
      }
  
      protected virtual bool SetProperty&lt;T&gt;(ref T storage, T value, [CallerMemberName] string propertyName = &quot;&quot;)
      {
          if (EqualityComparer&lt;T&gt;.Default.Equals(storage, value))
              return false;
          storage = value;
          this.OnPropertyChanged(propertyName);
          return true;
      }
  }
  </code></pre>
  <p>When using an async Task on MVVM, shouldn't it leave the UI thread free? But it seems to be locking the thread, even when I use ConfigAwait(false).</p>
  <p>Any help is appreaciated.</p>