Pass TaskScheduler.FromCurrentSynchronizationContext()
to ContinueWith()
...
.ContinueWith((task) => {
// hide loading mas
Core.HideLoadingMask();
if (frm != null) this.Panel.Controls.Add(frm);
}, TaskScheduler.FromCurrentSynchronizationContext());