sealed class Program
{
static WebsiteAccessor _accessor;
static void Main(string[] args)
{
WebsiteAccessor.CreateAsync("URL_HERE").ContinueWith(m =>
{
_accessor = m.Result;
}, TaskScheduler.FromCurrentSynchronizationContext());
}
}
The code above works just fine on WPF (MVVM) and WinForms, but for some reason, it's not on console applications.
The error being returned:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Private.CoreLib.dll: 'The current SynchronizationContext may not be used as a TaskScheduler.'