Imported Upstream version 5.0.0.94

Former-commit-id: 09772966aff74491c7b98b6eda49852cfc4aa874
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-05-03 16:24:32 +00:00
parent 5c980d35e6
commit 67a5eefa39
30 changed files with 191 additions and 38 deletions

View File

@ -325,10 +325,14 @@ namespace MonoTests.System.Threading
} catch (ObjectDisposedException) {
}
try {
token.Register (() => { });
Assert.Fail ("#3");
} catch (ObjectDisposedException) {
bool throwOnDispose = false;
AppContext.TryGetSwitch ("Switch.System.Threading.ThrowExceptionIfDisposedCancellationTokenSource", out throwOnDispose);
if (throwOnDispose) {
try {
token.Register (() => { });
Assert.Fail ("#3");
} catch (ObjectDisposedException) {
}
}
try {
@ -337,10 +341,12 @@ namespace MonoTests.System.Threading
} catch (ObjectDisposedException) {
}
try {
CancellationTokenSource.CreateLinkedTokenSource (token);
Assert.Fail ("#5");
} catch (ObjectDisposedException) {
if (throwOnDispose) {
try {
CancellationTokenSource.CreateLinkedTokenSource (token);
Assert.Fail ("#5");
} catch (ObjectDisposedException) {
}
}
try {