-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle disposed cancellation token (#1163)
- Loading branch information
1 parent
f3f64ea
commit e3072df
Showing
9 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/StrictJsonTests/SerializationTests.CancellationToken_Cancelled.verified.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"IsCancellationRequested": true, | ||
"Token": true, | ||
"WaitHandle": { | ||
"SafeWaitHandle": { | ||
"IsInvalid": false, | ||
"IsClosed": false | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/StrictJsonTests/SerializationTests.CancellationToken_CancelledDisposed.verified.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"IsCancellationRequested": true, | ||
"Token": true | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Verify.Tests/Serialization/SerializationTests.CancellationToken_Cancelled.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
IsCancellationRequested: true, | ||
Token: true, | ||
WaitHandle: { | ||
SafeWaitHandle: { | ||
IsInvalid: false, | ||
IsClosed: false | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...y.Tests/Serialization/SerializationTests.CancellationToken_CancelledDisposed.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
IsCancellationRequested: true, | ||
Token: true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class CancelConverter : | ||
WriteOnlyJsonConverter<Cancel> | ||
{ | ||
public override void Write(VerifyJsonWriter writer, Cancel value) | ||
{ | ||
writer.WriteStartObject(); | ||
|
||
writer.WriteMember(value, value.IsCancellationRequested, "IsCancellationRequested"); | ||
writer.WriteMember(value, value.CanBeCanceled, "Token"); | ||
try | ||
{ | ||
writer.WriteMember(value, value.WaitHandle, "WaitHandle"); | ||
} | ||
catch (ObjectDisposedException) | ||
{ | ||
} | ||
|
||
writer.WriteEndObject(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters