I'm trying to write code around the asynchronous methods based on the TAP pattern with async and await in .NET 4.5.
For example
public Task ConnectAsync()
{
return Task.Factory.FromAsync(secureFtp.BeginConnect, secureFtp.EndConnect, secureFtp);
}
That works, except I do not get any errors when it cannot connect. I'm unsure if it is from my unfamiliarity with the new TAP pattern, or asynchronous for that matter, or if the edt dll eats the error.
I do get an error if I subscribe to the error event on the SecureFTPConnection but that seems like mixing async models. I believe this may be my unfamiliarity with the new pattern and how it is supposed to mesh with the APM pattern.