File tree Expand file tree Collapse file tree 8 files changed +38
-1
lines changed
Open.ChannelExtensions.Tests Expand file tree Collapse file tree 8 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ public static async Task ReadAllConcurrentlyAsEnumerables()
136136 {
137137 // loop delay
138138 }
139+
139140 Interlocked . Increment ( ref total ) ;
140141 }
141142 } ) ;
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ await c.Reader
4747 default :
4848 throw new Exception ( "Shouldn't arrive here." ) ;
4949 }
50+
5051 await Task . Delay ( 500 ) ;
5152 } ) ;
5253 }
@@ -99,6 +100,7 @@ await c.Reader
99100 default :
100101 throw new Exception ( "Shouldn't arrive here." ) ;
101102 }
103+
102104 await Task . Delay ( 500 ) ;
103105 } ) ;
104106 }
@@ -142,6 +144,7 @@ public static async Task ForceBatchTest()
142144 default :
143145 throw new Exception ( "Shouldn't arrive here." ) ;
144146 }
147+
145148 await Task . Delay ( 500 ) ;
146149 } ) ) ;
147150 }
@@ -190,6 +193,7 @@ public static async Task ForceBatchTest2()
190193 default :
191194 throw new Exception ( "Shouldn't arrive here." ) ;
192195 }
196+
193197 await Task . Delay ( 500 ) ;
194198 } ) ) ;
195199 }
@@ -227,6 +231,7 @@ public static async Task TimeoutTest0()
227231 default :
228232 throw new Exception ( "Shouldn't arrive here." ) ;
229233 }
234+
230235 await Task . Delay ( 100 ) ;
231236 } ) ) ;
232237 }
@@ -249,6 +254,7 @@ public static async Task TimeoutTest1()
249254 {
250255 c . Writer . TryWrite ( i ) ;
251256 }
257+
252258 c . Writer . Complete ( ) ;
253259 } ) ;
254260
@@ -272,6 +278,7 @@ public static async Task TimeoutTest1()
272278 default :
273279 throw new Exception ( "Shouldn't arrive here." ) ;
274280 }
281+
275282 await Task . Delay ( 100 ) ;
276283 } ) ) ;
277284 }
@@ -395,8 +402,10 @@ public static async Task ReadBatchWithTimeoutEnumerableBakedIn()
395402 default :
396403 throw new Exception ( "Shouldn't arrive here." ) ;
397404 }
405+
398406 i ++ ;
399407 }
408+
400409 Assert . Equal ( 3 , i ) ;
401410 await c . Reader . Completion ; // Propagate possible failure
402411 }
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ await c.Reader
4646 default :
4747 throw new Exception ( "Shouldn't arrive here." ) ;
4848 }
49+
4950 await Task . Delay ( 500 ) ;
5051 } ) ;
5152 }
@@ -98,6 +99,7 @@ await c.Reader
9899 default :
99100 throw new Exception ( "Shouldn't arrive here." ) ;
100101 }
102+
101103 await Task . Delay ( 500 ) ;
102104 } ) ;
103105 }
@@ -154,6 +156,7 @@ public static async Task ForceBatchTest()
154156 default :
155157 throw new Exception ( "Shouldn't arrive here." ) ;
156158 }
159+
157160 await Task . Delay ( 500 ) ;
158161 } ) ) ;
159162 }
@@ -210,6 +213,7 @@ public static async Task ForceBatchTest2()
210213 default :
211214 throw new Exception ( "Shouldn't arrive here." ) ;
212215 }
216+
213217 await Task . Delay ( 500 ) ;
214218 } ) ) ;
215219 }
@@ -245,6 +249,7 @@ public static async Task TimeoutTest0()
245249 default :
246250 throw new Exception ( "Shouldn't arrive here." ) ;
247251 }
252+
248253 await Task . Delay ( 100 ) ;
249254 } ) ) ;
250255 }
@@ -267,6 +272,7 @@ public static async Task TimeoutTest1()
267272 {
268273 c . Writer . TryWrite ( i ) ;
269274 }
275+
270276 c . Writer . Complete ( ) ;
271277 } ) ;
272278
@@ -287,6 +293,7 @@ public static async Task TimeoutTest1()
287293 default :
288294 throw new Exception ( "Shouldn't arrive here." ) ;
289295 }
296+
290297 await Task . Delay ( 100 ) ;
291298 } ) ) ;
292299 }
@@ -412,8 +419,10 @@ public static async Task ReadBatchWithTimeoutEnumerableBakedIn()
412419 default :
413420 throw new Exception ( "Shouldn't arrive here. Got batch: " + string . Join ( ',' , batch . Select ( item => item ) ) ) ;
414421 }
422+
415423 i ++ ;
416424 }
425+
417426 Assert . Equal ( 3 , i ) ;
418427 await c . Reader . Completion ; // Propagate possible failure
419428 }
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ await c.Reader
4444 default :
4545 throw new Exception ( "Shouldn't arrive here." ) ;
4646 }
47+
4748 await Task . Delay ( 500 ) ;
4849 } ) ;
4950 }
@@ -93,6 +94,7 @@ await c.Reader
9394 default :
9495 throw new Exception ( "Shouldn't arrive here." ) ;
9596 }
97+
9698 await Task . Delay ( 500 ) ;
9799 } ) ;
98100 }
@@ -133,6 +135,7 @@ public static async Task ForceBatchTest()
133135 default :
134136 throw new Exception ( "Shouldn't arrive here." ) ;
135137 }
138+
136139 await Task . Delay ( 500 ) ;
137140 } ) ) ;
138141 }
@@ -178,6 +181,7 @@ public static async Task ForceBatchTest2()
178181 default :
179182 throw new Exception ( "Shouldn't arrive here." ) ;
180183 }
184+
181185 await Task . Delay ( 500 ) ;
182186 } ) ) ;
183187 }
@@ -213,6 +217,7 @@ public static async Task TimeoutTest0()
213217 default :
214218 throw new Exception ( "Shouldn't arrive here." ) ;
215219 }
220+
216221 await Task . Delay ( 100 ) ;
217222 } ) ) ;
218223 }
@@ -235,6 +240,7 @@ public static async Task TimeoutTest1()
235240 {
236241 c . Writer . TryWrite ( i ) ;
237242 }
243+
238244 c . Writer . Complete ( ) ;
239245 } ) ;
240246
@@ -255,6 +261,7 @@ public static async Task TimeoutTest1()
255261 default :
256262 throw new Exception ( "Shouldn't arrive here." ) ;
257263 }
264+
258265 await Task . Delay ( 100 ) ;
259266 } ) ) ;
260267 }
@@ -373,8 +380,10 @@ public static async Task ReadBatchWithTimeoutEnumerableBakedIn()
373380 default :
374381 throw new Exception ( "Shouldn't arrive here. Got batch: " + string . Join ( ',' , batch . Select ( item => item ) ) ) ;
375382 }
383+
376384 i ++ ;
377385 }
386+
378387 Assert . Equal ( 3 , i ) ;
379388 await c . Reader . Completion ; // Propagate possible failure
380389 }
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ await range
2020 Interlocked . Increment ( ref count ) ;
2121 tokenSource . Cancel ( ) ;
2222 }
23+
2324 token . ThrowIfCancellationRequested ( ) ;
2425 } ) ;
2526 }
@@ -52,6 +53,7 @@ await range
5253 Interlocked . Increment ( ref count ) ;
5354 tokenSource . Cancel ( ) ;
5455 }
56+
5557 token . ThrowIfCancellationRequested ( ) ;
5658 } ) ;
5759 }
Original file line number Diff line number Diff line change @@ -392,6 +392,7 @@ public static async ValueTask ReadAllAsEnumerablesAsync<T>(this ChannelReader<T>
392392 {
393393 await receiver ( reader . ReadAvailable ( cancellationToken ) ) . ConfigureAwait ( false ) ;
394394 }
395+
395396 return ;
396397 }
397398
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ await target
4343 count ++ ;
4444 next = target . WriteAsync ( value , cancellationToken ) ;
4545 }
46+
4647 await next . ConfigureAwait ( false ) ;
4748 return count ;
4849 }
@@ -54,6 +55,7 @@ await target
5455 target . TryComplete ( ex ) ;
5556 complete = false ;
5657 }
58+
5759 throw ;
5860 }
5961 finally
@@ -272,6 +274,7 @@ public static async ValueTask<long> WriteAllLines(
272274 count ++ ;
273275 next = target . WriteAsync ( line , cancellationToken ) ;
274276 }
277+
275278 await next . ConfigureAwait ( false ) ;
276279 if ( more ) cancellationToken . ThrowIfCancellationRequested ( ) ;
277280 return count ;
@@ -284,6 +287,7 @@ public static async ValueTask<long> WriteAllLines(
284287 target . TryComplete ( ex ) ;
285288 complete = false ;
286289 }
290+
287291 throw ;
288292 }
289293 finally
@@ -345,6 +349,7 @@ await target
345349 count ++ ;
346350 next = target . WriteAsync ( value , cancellationToken ) ;
347351 }
352+
348353 await next . ConfigureAwait ( false ) ;
349354 return count ;
350355 }
@@ -356,6 +361,7 @@ await target
356361 target . TryComplete ( ex ) ;
357362 complete = false ;
358363 }
364+
359365 throw ;
360366 }
361367 finally
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFrameworks >netstandard2.0; netstandard2.1; net6.0; net8.0</TargetFrameworks >
4+ <TargetFrameworks >netstandard2.0; netstandard2.1; net6.0; net8.0; net9.0; </TargetFrameworks >
55 <LangVersion >latest</LangVersion >
66 <EnableNETAnalyzers >true</EnableNETAnalyzers >
77 <AnalysisMode >AllEnabledByDefault</AnalysisMode >
You can’t perform that action at this time.
0 commit comments