This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
tests/TaskSystemIntegrationTests Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public interface ITask : IAsyncResult
24
24
/// <summary>
25
25
/// Run a callback at the end of the task execution, on a separate thread, regardless of execution state
26
26
/// </summary>
27
- ITask Finally ( Action < bool , Exception > actionToContinueWith , TaskAffinity affinity = TaskAffinity . Concurrent ) ;
27
+ ITask Finally ( Action < bool , Exception > actionToContinueWith , TaskAffinity affinity ) ;
28
28
/// <summary>
29
29
/// Run another task at the end of the task execution, on a separate thread, regardless of execution state
30
30
/// </summary>
Original file line number Diff line number Diff line change @@ -600,7 +600,9 @@ public async Task StartAndEndAreAlwaysRaised()
600
600
ITask task = new ActionTask ( Token , _ => { throw new Exception ( ) ; } ) ;
601
601
task . OnStart += _ => runOrder . Add ( "start" ) ;
602
602
task . OnEnd += ( _ , __ , ___ ) => runOrder . Add ( "end" ) ;
603
- task = task . Finally ( ( _ , __ ) => { } ) ;
603
+ // we want to run a Finally on a new task (and not in-thread) so that the StartAndSwallowException handler runs after this
604
+ // one, proving that the exception is propagated after everything is done
605
+ task = task . Finally ( ( _ , __ ) => { } , TaskAffinity . Concurrent ) ;
604
606
605
607
await task . StartAndSwallowException ( ) ;
606
608
CollectionAssert . AreEqual ( new string [ ] { "start" , "end" } , runOrder ) ;
You can’t perform that action at this time.
0 commit comments