Skip to content

Commit

Permalink
Deprecating WaitForResult()
Browse files Browse the repository at this point in the history
Resolves #19
  • Loading branch information
atheken committed Apr 9, 2015
1 parent 1b2c98e commit b882246
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Postmark.PCL/TaskExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;

namespace PostmarkDotNet
{
Expand All @@ -8,10 +9,21 @@ public static class TaskExtensions
/// <summary>
/// Escape async/await by runing the task synchronously,
/// will block the current thread until the task completes.
///
/// DO NOT USE THIS IN A UI THREAD.
/// It will cause your application to become deadlocked.
/// <see cref="http://blogs.msdn.com/b/pfxteam/archive/2011/01/13/10115163.aspx"/>
/// </summary>
/// <remarks>
/// You should avoid using this method in new code. If you're unable to use async/await support,
/// consider using "ContinueWith()" <see cref="https://msdn.microsoft.com/en-us/library/dd321474(v=vs.110).aspx"/>
/// in order to ensure proper sequencing operations.
/// </remarks>
/// <typeparam name="T"></typeparam>
/// <param name="task"></param>
/// <returns></returns>
[Obsolete("This convenience method has been deprecated" +
" because it is known cause issues in specific use cases.")]
public static T WaitForResult<T>(this Task<T> task)
{
task.Wait();
Expand Down

0 comments on commit b882246

Please sign in to comment.