Skip to content
This repository was archived by the owner on Jan 14, 2021. It is now read-only.

Commit 09ad9cf

Browse files
lewurmakoeplinger
authored andcommitted
[FinallyDelegate] add comments for why CallContext is used (#9)
1 parent ab5cc9c commit 09ad9cf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

NUnitLite-1.0.0/src/framework/FinallyDelegate.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@ public class FinallyDelegate
6464

6565
Dictionary<Guid, TestResult> lookupTable;
6666

67+
// Why is CallContext used? Consider the following scenario:
68+
//
69+
// * say Test_A runs in Thread_1
70+
// * Test_A spawns another Thread_2
71+
// * Thread_1 finishes with Test_A, and moves on to Test_B
72+
// * Thread_2 isn't done yet really, crashes and causes an unhandled exception
73+
// * we need a way to map this unhandled exception to Test_A, although Test_B is the currently running test
74+
//
75+
// => what we need is some sort of "thread local" that gets inherited: when
76+
// Thread_1 creates Thread_2, it needs to have the same "thread local" values.
77+
// that is achieved with `CallContext`.
78+
//
79+
// Unfortunately, remoting isn't available on every platform, thus we can't
80+
// support this scenario. Luckily, this scenario is very rare.
81+
6782
#if NO_REMOTING
6883
static Container container;
6984
#else

0 commit comments

Comments
 (0)