File tree Expand file tree Collapse file tree 3 files changed +6
-11
lines changed
Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Original file line number Diff line number Diff line change 1+ # Copilot Instructions
2+
3+ ## General Guidelines
4+ - Prefer keeping ` TaskScheduler.Current ` in ` BufferingChannelReader ` completion continuation; changing to ` TaskScheduler.Default ` breaks intended behavior.
Original file line number Diff line number Diff line change 2222 <RepositoryType >git</RepositoryType >
2323 <GeneratePackageOnBuild >true</GeneratePackageOnBuild >
2424 <GenerateDocumentationFile >true</GenerateDocumentationFile >
25- <Version >9.1.2 </Version >
25+ <Version >9.1.3 </Version >
2626 <PackageReleaseNotes >Ensure the current task scheduler is used and that it can be configured.</PackageReleaseNotes >
2727 <PackageLicenseExpression >MIT</PackageLicenseExpression >
2828 <PublishRepositoryUrl >true</PublishRepositoryUrl >
Original file line number Diff line number Diff line change @@ -245,22 +245,13 @@ protected override async ValueTask<bool> WaitToReadAsyncCore(
245245 }
246246
247247 // WhenAny will not throw when a task is cancelled.
248- Task < bool > sTask = s . AsTask ( ) ;
249- await Task . WhenAny ( sTask , b ) . ConfigureAwait ( false ) ;
248+ await Task . WhenAny ( s . AsTask ( ) , b ) . ConfigureAwait ( false ) ;
250249 if ( b . IsCompleted ) // Assuming it was bufferWait that completed.
251250 {
252251 await tokenSource . CancelAsync ( ) . ConfigureAwait ( false ) ;
253252 return await b . ConfigureAwait ( false ) ;
254253 }
255254
256- // Await the source task to check if it completed and get its result
257- // This prevents a tight loop when the source is closed
258- await sTask . ConfigureAwait ( false ) ;
259- // Check if buffer completed while we were waiting (e.g., timeout forced a batch)
260- // If so, return immediately without trying to pipe more items
261- if ( b . IsCompleted )
262- return await b . ConfigureAwait ( false ) ;
263-
264255 TryPipeItems ( false ) ;
265256
266257 if ( b . IsCompleted || token . IsCancellationRequested )
You can’t perform that action at this time.
0 commit comments