2424// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525// ***********************************************************************
2626
27+ #if __IOS__ || __WATCHOS__ || __TVOS__
28+ #define NO_REMOTING
29+ #endif
30+
2731using System ;
2832using System . Diagnostics ;
2933using System . Threading ;
@@ -60,7 +64,11 @@ public class FinallyDelegate
6064
6165 Dictionary < Guid , TestResult > lookupTable ;
6266
67+ #if NO_REMOTING
68+ static Container container ;
69+ #else
6370 private static readonly string CONTEXT_KEY = "TestResultName" ;
71+ #endif
6472
6573 public FinallyDelegate ( ) {
6674 this . testStack = new Stack < Tuple < TestExecutionContext , long , TestResult > > ( ) ;
@@ -73,14 +81,22 @@ public void Set (TestExecutionContext context, long startTicks, TestResult resul
7381 /* keep name in LogicalCallContext, because this will be inherited by
7482 * Threads spawned by the test case */
7583 var guid = Guid . NewGuid ( ) ;
84+ #if NO_REMOTING
85+ container = new Container ( guid ) ;
86+ #else
7687 CallContext . SetData ( CONTEXT_KEY , new Container ( guid ) ) ;
88+ #endif
7789
7890 this . lookupTable . Add ( guid , result ) ;
7991 this . testStack . Push ( frame ) ;
8092 }
8193
8294 public void HandleUnhandledExc ( Exception ex ) {
95+ #if NO_REMOTING
96+ Container c = container ;
97+ #else
8398 Container c = ( Container ) CallContext . GetData ( CONTEXT_KEY ) ;
99+ #endif
84100 TestResult result = this . lookupTable [ c . guid ] ;
85101 result . RecordException ( ex ) ;
86102 result . ThreadCrashFail = true ;
0 commit comments