Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Remove ValueTask<T>.CreateAsyncMethodBuilder from ref #26703

Merged
merged 1 commit into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7978,8 +7978,6 @@ public void SetObserved() { }
public TResult Result { get { throw null; } }
public System.Threading.Tasks.Task<TResult> AsTask() { throw null; }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
public static System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder<TResult> CreateAsyncMethodBuilder() { throw null; }
public override bool Equals(object obj) { throw null; }
public bool Equals(System.Threading.Tasks.ValueTask<TResult> other) { throw null; }
public System.Runtime.CompilerServices.ValueTaskAwaiter<TResult> GetAwaiter() { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ namespace System.Threading.Tasks
public TResult Result { get { throw null; } }
public System.Threading.Tasks.Task<TResult> AsTask() { throw null; }
public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
public static System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder<TResult> CreateAsyncMethodBuilder() { throw null; }
public override bool Equals(object obj) { throw null; }
public bool Equals(System.Threading.Tasks.ValueTask<TResult> other) { throw null; }
public System.Runtime.CompilerServices.ValueTaskAwaiter<TResult> GetAwaiter() { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public class AsyncValueTaskMethodBuilderTests
[Fact]
public void Create_ReturnsDefaultInstance()
{
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;
Assert.Equal(default(AsyncValueTaskMethodBuilder<int>), b); // implementation detail being verified
}

[Fact]
public void SetResult_BeforeAccessTask_ValueTaskContainsValue()
{
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;
b.SetResult(42);
ValueTask<int> vt = b.Task;
Assert.True(vt.IsCompletedSuccessfully);
Expand All @@ -31,7 +31,7 @@ public void SetResult_BeforeAccessTask_ValueTaskContainsValue()
[Fact]
public void SetResult_AfterAccessTask_ValueTaskContainsValue()
{
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;
ValueTask<int> vt = b.Task;
b.SetResult(42);
Assert.True(vt.IsCompletedSuccessfully);
Expand All @@ -42,7 +42,7 @@ public void SetResult_AfterAccessTask_ValueTaskContainsValue()
[Fact]
public void SetException_BeforeAccessTask_FaultsTask()
{
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;
var e = new FormatException();
b.SetException(e);
ValueTask<int> vt = b.Task;
Expand All @@ -53,7 +53,7 @@ public void SetException_BeforeAccessTask_FaultsTask()
[Fact]
public void SetException_AfterAccessTask_FaultsTask()
{
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;
var e = new FormatException();
ValueTask<int> vt = b.Task;
b.SetException(e);
Expand All @@ -64,7 +64,7 @@ public void SetException_AfterAccessTask_FaultsTask()
[Fact]
public void SetException_OperationCanceledException_CancelsTask()
{
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;
var e = new OperationCanceledException();
ValueTask<int> vt = b.Task;
b.SetException(e);
Expand All @@ -75,7 +75,7 @@ public void SetException_OperationCanceledException_CancelsTask()
[Fact]
public void Start_InvokesMoveNext()
{
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;
int invokes = 0;
var dsm = new DelegateStateMachine { MoveNextDelegate = () => invokes++ };
b.Start(ref dsm);
Expand All @@ -89,7 +89,7 @@ public void Start_InvokesMoveNext()
[InlineData(2, true)]
public void AwaitOnCompleted_ForcesTaskCreation(int numAwaits, bool awaitUnsafe)
{
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;

var dsm = new DelegateStateMachine();
TaskAwaiter<int> t = new TaskCompletionSource<int>().Task.GetAwaiter();
Expand Down Expand Up @@ -117,7 +117,7 @@ public void AwaitOnCompleted_ForcesTaskCreation(int numAwaits, bool awaitUnsafe)
[ActiveIssue("https://github.com/dotnet/corefx/issues/22506", TargetFrameworkMonikers.UapAot)]
public void SetStateMachine_InvalidArgument_ThrowsException()
{
AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;
AssertExtensions.Throws<ArgumentNullException>("stateMachine", () => b.SetStateMachine(null));
}

Expand All @@ -144,7 +144,7 @@ public void Start_ExecutionContextChangesInMoveNextDontFlowOut()
Assert.Equal(2, al.Value);
Assert.Equal(2, calls);

AsyncValueTaskMethodBuilder<int> b = ValueTask<int>.CreateAsyncMethodBuilder();
AsyncValueTaskMethodBuilder<int> b = default;
b.Start(ref dsm);
Assert.Equal(2, al.Value); // change should not be visible
Assert.Equal(3, calls);
Expand Down