After spending far too much time trying to sort out async/await hell we're trying to get a standard for when we have to call an async method on a library we don't control and where there is no non-async method provided and get async out of our code all together.
I don't want a discussion of the merits of this I'm sure that for some people async/await works, just a foolproof way of calling any async method and not getting deadlocks etc.
Does
public someObject SomeFunction(string parameter)
{
return Task.Run(() => 3rdPartyLib.SomeFunctionAsync(parameter)).Result;
}
and
public void SomeMethod()
{
return Task.Run(() => 3rdPartyLib.SomeMethodAsync()).Wait;
}
Do the job? Do I need to configureAwait(false)? Will exceptions work normally?