summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs
index c8145d87c6..e96fe14b34 100644
--- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs
+++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs
@@ -683,7 +683,7 @@ namespace System.Threading.Tasks
asyncResult.AsyncWaitHandle,
delegate
{
- try { t.InternalRunSynchronously(scheduler, waitForCompletion: false); }
+ try { t.InternalRunSynchronously(scheduler!, waitForCompletion: false); } // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538
catch (Exception e) { promise.TrySetException(e); } // catch and log any scheduler exceptions
},
null,
diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs
index a8aac04936..2c35214248 100644
--- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs
+++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs
@@ -4477,7 +4477,8 @@ namespace System.Threading.Tasks
// Task is completed. Nothing to do here.
if (continuationsLocalRef == s_taskCompletionSentinel) return;
- if (!(continuationsLocalRef is List<object?> continuationsLocalListRef))
+ List<object?>? continuationsLocalListRef = continuationsLocalRef as List<object?>;
+ if (continuationsLocalListRef is null)
{
// This is not a list. If we have a single object (the one we want to remove) we try to replace it with an empty list.
// Note we cannot go back to a null state, since it will mess up the AddTaskContinuation logic.