Skip to content

Commit b218c7f

Browse files
eabaAaronontheweb
andauthored
Fix in CS4014 (#6633)
Co-authored-by: Aaron Stannard <[email protected]>
1 parent 4ffa22a commit b218c7f

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed

src/core/Akka.Streams.Tests/Dsl/FlowSelectAsyncSpec.cs

+2
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ await this.AssertAllStagesStoppedAsync(async() =>
345345
var counter = new AtomicCounter();
346346
var queue = new BlockingQueue<(TaskCompletionSource<int>, long)>();
347347
var cancellation = new CancellationTokenSource();
348+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
348349
Task.Run(() =>
349350
{
350351
var delay = 500; // 50000 nanoseconds
@@ -369,6 +370,7 @@ await this.AssertAllStagesStoppedAsync(async() =>
369370
}
370371
}
371372
}, cancellation.Token);
373+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
372374

373375
Func<Task<int>> deferred = () =>
374376
{

src/core/Akka.Streams.Tests/Dsl/FlowWireTapSpec.cs

+2
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ public async Task A_wireTap_must_yield_the_first_error()
6060
await this.AssertAllStagesStoppedAsync(async() => {
6161
var p = this.CreateManualPublisherProbe<int>();
6262

63+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
6364
Source.FromPublisher(p)
6465
.WireTap(i => TestActor.Tell(i))
6566
.RunWith(Sink.Ignore<int>(), Materializer)
6667
.ContinueWith(t => TestActor.Tell(t.Exception.InnerException));
68+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
6769

6870
var proc = await p.ExpectSubscriptionAsync();
6971
await proc.ExpectRequestAsync();

src/core/Akka.Streams.Tests/Dsl/LazySourceSpec.cs

+2
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,14 @@ await this.AssertAllStagesStoppedAsync(async() => {
138138
var boom = new TestException("boom");
139139
await probe.ExpectMsgAsync<Done>();
140140
killSwitch.Abort(boom);
141+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
141142
doneF.ContinueWith(t =>
142143
{
143144
t.Exception.Should().NotBeNull();
144145
t.Exception.InnerException.Should().NotBeNull();
145146
t.Exception.InnerException.Should().Be(boom);
146147
});
148+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
147149
}, Materializer);
148150
}
149151

src/core/Akka.Streams.Tests/Dsl/QueueSinkSpec.cs

+20
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
5353

5454
foreach(var v in expected)
5555
{
56+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
5657
queue.PullAsync().PipeTo(TestActor);
58+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
5759
await ExpectMsgAsync(v);
5860
};
5961
}, _materializer);
@@ -71,7 +73,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
7173
future2.Invoking(t => t.Wait(RemainingOrDefault)).Should().Throw<IllegalStateException>();
7274

7375
sub.SendNext(1);
76+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
7477
future.PipeTo(TestActor);
78+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
7579
await ExpectMsgAsync(Option<int>.Create(1));
7680

7781
sub.SendComplete();
@@ -87,7 +91,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
8791
var queue = Source.FromPublisher(probe).RunWith(Sink.Queue<int>(), _materializer);
8892
var sub = probe.ExpectSubscription();
8993

94+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
9095
queue.PullAsync().PipeTo(TestActor);
96+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
9197
await ExpectNoMsgAsync(_pause);
9298

9399
sub.SendNext(1);
@@ -105,7 +111,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
105111
var queue = Source.FromPublisher(probe).RunWith(Sink.Queue<int>(), _materializer);
106112
var sub = await probe.ExpectSubscriptionAsync();
107113

114+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
108115
queue.PullAsync().PipeTo(TestActor);
116+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
109117
await ExpectNoMsgAsync(_pause);
110118

111119
sub.SendError(TestException());
@@ -136,7 +144,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
136144
var queue = Source.FromPublisher(probe).RunWith(Sink.Queue<int>(), _materializer);
137145
var sub = await probe.ExpectSubscriptionAsync();
138146

147+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
139148
queue.PullAsync().PipeTo(TestActor);
149+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
140150
await ExpectNoMsgAsync(_pause);
141151

142152
sub.SendNext(1);
@@ -154,7 +164,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
154164
var queue = Source.FromPublisher(probe).RunWith(Sink.Queue<int>(), _materializer);
155165
var sub = await probe.ExpectSubscriptionAsync();
156166

167+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
157168
queue.PullAsync().PipeTo(TestActor);
169+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
158170
sub.SendNext(1);
159171
await ExpectMsgAsync(Option<int>.Create(1));
160172

@@ -186,10 +198,14 @@ await this.AssertAllStagesStoppedAsync(async() => {
186198

187199
for (var i = 1; i <= streamElementCount; i++)
188200
{
201+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
189202
queue.PullAsync().PipeTo(TestActor);
203+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
190204
await ExpectMsgAsync(Option<int>.Create(i));
191205
}
206+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
192207
queue.PullAsync().PipeTo(TestActor);
208+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
193209
await ExpectMsgAsync(Option<int>.None);
194210
}, _materializer);
195211
}
@@ -203,11 +219,15 @@ await this.AssertAllStagesStoppedAsync(async() => {
203219
var queue = Source.FromPublisher(probe).RunWith(sink, _materializer);
204220
var sub = await probe.ExpectSubscriptionAsync();
205221

222+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
206223
queue.PullAsync().PipeTo(TestActor);
224+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
207225
sub.SendNext(1); // should pull next element
208226
await ExpectMsgAsync(Option<int>.Create(1));
209227

228+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
210229
queue.PullAsync().PipeTo(TestActor);
230+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
211231
await ExpectNoMsgAsync(); // element requested but buffer empty
212232
sub.SendNext(2);
213233
await ExpectMsgAsync(Option<int>.Create(2));

src/core/Akka.Streams.Tests/Dsl/QueueSourceSpec.cs

+26
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
140140
.Run(_materializer);
141141
var sub = await s.ExpectSubscriptionAsync();
142142

143+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
143144
queue.OfferAsync(1).PipeTo(TestActor);
145+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
144146
await ExpectNoMsgAsync(_pause);
145147
sub.Request(1);
146148
await ExpectMsgAsync<Enqueued>();
@@ -160,10 +162,14 @@ await this.AssertAllStagesStoppedAsync(async() => {
160162
.Run(_materializer);
161163
var sub = await s.ExpectSubscriptionAsync();
162164

165+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
163166
queue.WatchCompletionAsync()
164167
.ContinueWith(t => "done", TaskContinuationOptions.OnlyOnRanToCompletion)
165168
.PipeTo(TestActor);
169+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
170+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
166171
queue.OfferAsync(1).PipeTo(TestActor);
172+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
167173
await ExpectNoMsgAsync(_pause);
168174

169175
sub.Cancel();
@@ -223,8 +229,12 @@ await this.AssertAllStagesStoppedAsync(async() => {
223229
for (var i = 1; i <= 5; i++)
224230
AssertSuccess(queue.OfferAsync(i));
225231

232+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
226233
queue.OfferAsync(6).PipeTo(TestActor);
234+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
235+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
227236
queue.OfferAsync(7).PipeTo(TestActor);
237+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
228238
var expect = await ExpectMsgAsync<Status.Failure>();
229239
expect.Cause.Should().BeOfType<IllegalStateException>();
230240
await probe.RequestNextAsync(1);
@@ -246,7 +256,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
246256
Source.Queue<int>(1, OverflowStrategy.Fail)
247257
.To(Sink.FromSubscriber(s))
248258
.Run(_materializer);
259+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
249260
queue.WatchCompletionAsync().PipeTo(TestActor);
261+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
250262
await queue.OfferAsync(1); // need to wait when first offer is done as initialization can be done in this moment
251263
await queue.OfferAsync(2);
252264
await ExpectMsgAsync<Status.Failure>();
@@ -262,7 +274,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
262274
var queue = Source.Queue<int>(1, OverflowStrategy.Fail)
263275
.To(Sink.FromSubscriber(s))
264276
.Run(tempMap);
277+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
265278
queue.WatchCompletionAsync().PipeTo(TestActor);
279+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
266280
tempMap.Shutdown();
267281
await ExpectMsgAsync<Status.Failure>();
268282
}, _materializer);
@@ -280,7 +294,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
280294
var sub = await s.ExpectSubscriptionAsync();
281295

282296
await queue.OfferAsync(1);
297+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
283298
queue.OfferAsync(2).PipeTo(TestActor);
299+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
284300
await ExpectMsgAsync<Dropped>();
285301

286302
sub.Request(1);
@@ -301,7 +317,9 @@ await this.AssertAllStagesStoppedAsync(async () => {
301317
var sub = await s.ExpectSubscriptionAsync();
302318
AssertSuccess(queue.OfferAsync(1));
303319

320+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
304321
queue.OfferAsync(2).PipeTo(TestActor);
322+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
305323
await ExpectNoMsgAsync(_pause);
306324

307325
sub.Request(1);
@@ -326,7 +344,9 @@ await this.AssertAllStagesStoppedAsync(async() => {
326344
.Run(_materializer);
327345
var sub = await s.ExpectSubscriptionAsync();
328346

347+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
329348
queue.WatchCompletionAsync().ContinueWith(t => Done.Instance).PipeTo(TestActor);
349+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
330350
sub.Cancel();
331351
await ExpectMsgAsync(Done.Instance);
332352

@@ -402,8 +422,12 @@ public async Task QueueSource_should_complete_the_stream_when_buffer_is_full_and
402422
var source = tuple.Item1;
403423
var probe = tuple.Item2;
404424

425+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
405426
source.OfferAsync(1);
427+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
428+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
406429
source.OfferAsync(2);
430+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
407431
source.Complete();
408432
await probe.RequestNext(1)
409433
.RequestNext(2)
@@ -440,7 +464,9 @@ public async Task QueueSource_should_complete_the_stream_when_no_buffer_is_used_
440464
var source = tuple.Item1;
441465
var probe = tuple.Item2;
442466

467+
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
443468
source.OfferAsync(1);
469+
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
444470
source.Complete();
445471
await probe.RequestNext(1).ExpectCompleteAsync();
446472
var task = source.WatchCompletionAsync();

0 commit comments

Comments
 (0)