Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit c9436c2

Browse files
committed
Make sure the threaded and non-threaded API is easily distinguishable
1 parent b814a24 commit c9436c2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/GitHub.Api/Tasks/TaskBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface ITask : IAsyncResult
2424
/// <summary>
2525
/// Run a callback at the end of the task execution, on a separate thread, regardless of execution state
2626
/// </summary>
27-
ITask Finally(Action<bool, Exception> actionToContinueWith, TaskAffinity affinity = TaskAffinity.Concurrent);
27+
ITask Finally(Action<bool, Exception> actionToContinueWith, TaskAffinity affinity);
2828
/// <summary>
2929
/// Run another task at the end of the task execution, on a separate thread, regardless of execution state
3030
/// </summary>

src/tests/TaskSystemIntegrationTests/Tests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,9 @@ public async Task StartAndEndAreAlwaysRaised()
600600
ITask task = new ActionTask(Token, _ => { throw new Exception(); });
601601
task.OnStart += _ => runOrder.Add("start");
602602
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);
604606

605607
await task.StartAndSwallowException();
606608
CollectionAssert.AreEqual(new string[] { "start", "end" }, runOrder);

0 commit comments

Comments
 (0)