-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[System]: Use new WebCompletionSource
instead of TaskCompletionSource
.
#7293
Conversation
@monojenkins build pkg |
@monojenkins backport 2018-02 |
32a6eaf
to
4075747
Compare
@monojenkins build pkg |
…rce<>`. This new helper class uses `TaskCompletionSource<>` internally, but instead of using TrySetException(), it sets a result containing an `ExceptionDispatchInfo`. The problem with using TrySetException() is that it wraps the exception object in an `AggregateException`, that would be unobserved if the caller throws the original exception.
4075747
to
1e546e5
Compare
WebCompletionSource
instead of TaskCompletionSource<>
.WebCompletionSource
instead of TaskCompletionSource
.
@monojenkins build pkg |
@monojenkins backport 2018-02 |
completion = new TaskCompletionSource<Result> (); | ||
} | ||
|
||
public bool SetCompleted () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be called TrySetCompleted
return completion.TrySetResult (new Result (1, null)); | ||
} | ||
|
||
public bool SetCanceled () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be called TrySetCanceled
|
||
public bool IsCompleted => completion.Task.IsCompleted; | ||
|
||
public void Throw () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually ThrowOnError, right?
|
||
class Result | ||
{ | ||
public int State { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use enum instead of int
@monojenkins backport 2018-02 |
…rce`. (mono#7293) This new helper class uses `TaskCompletionSource<>` internally, but instead of using TrySetException(), it sets a result containing an `ExceptionDispatchInfo`. The problem with using TrySetException() is that it wraps the exception object in an `AggregateException`, that would be unobserved if the caller throws the original exception.
…rce`. (mono#7293) This new helper class uses `TaskCompletionSource<>` internally, but instead of using TrySetException(), it sets a result containing an `ExceptionDispatchInfo`. The problem with using TrySetException() is that it wraps the exception object in an `AggregateException`, that would be unobserved if the caller throws the original exception.
This new helper class uses
TaskCompletionSource<>
internally, but insteadof using TrySetException(), it sets a result containing an
ExceptionDispatchInfo
.The problem with using TrySetException() is that it wraps the exception
object in an
AggregateException
, that would be unobserved if the callerthrows the original exception.
#7194