Skip to content

Commit

Permalink
Fix nullability warnings in System.Diagnostics.Process (dotnet#32211)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub authored Feb 13, 2020
1 parent 4a57d14 commit 3158b52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable
namespace System.Threading.Tasks
{
/// <summary>
Expand All @@ -25,7 +26,7 @@ private void OnCancellation()
public async ValueTask<T> WaitWithCancellationAsync(CancellationToken cancellationToken)
{
_cancellationToken = cancellationToken;
using (cancellationToken.UnsafeRegister(s => ((TaskCompletionSourceWithCancellation<T>)s).OnCancellation(), this))
using (cancellationToken.UnsafeRegister(s => ((TaskCompletionSourceWithCancellation<T>)s!).OnCancellation(), this))
{
return await Task.ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1426,9 +1426,9 @@ public async Task WaitForExitAsync(CancellationToken cancellationToken = default
throw;
}

var tcs = new TaskCompletionSourceWithCancellation<object>();
var tcs = new TaskCompletionSourceWithCancellation<bool>();

EventHandler handler = (s, e) => tcs.TrySetResult(null);
EventHandler handler = (s, e) => tcs.TrySetResult(true);
Exited += handler;

try
Expand Down

0 comments on commit 3158b52

Please sign in to comment.