private string PerformTest(ThrowLocation location, bool catchInInnerHandler)
 {
     try
     {
         using (WorkContext ctxMain = WorkContext.EnterNew("main"))
         {
             try
             {
                 using (WorkContext ctxSub1 = WorkContext.EnterNew("sub1"))
                 {
                     if (location == ThrowLocation.sub1_inside)
                     {
                         throw new Exception(location.ToString());
                     }
                     ctxSub1.Done();
                 }
                 if (location == ThrowLocation.sub1_outside)
                 {
                     throw new Exception(location.ToString());
                 }
             }
             catch (Exception e)
             {
                 if (!catchInInnerHandler)
                 {
                     throw;
                 }
                 Assert.That(e.Message, Is.EqualTo(location.ToString()));
                 return(WorkContext.Stack.ToString());
             }
             try
             {
                 using (WorkContext ctxSub2 = WorkContext.EnterNew("sub2"))
                 {
                     using (WorkContext ctxSub2_1 = WorkContext.EnterNew("sub2.1"))
                     {
                         if (location == ThrowLocation.sub2_1_inside)
                         {
                             throw new Exception(location.ToString());
                         }
                         ctxSub2_1.Done();
                     }
                     if (location == ThrowLocation.sub2_inside)
                     {
                         throw new Exception(location.ToString());
                     }
                     ctxSub2.Done();
                 }
                 if (location == ThrowLocation.sub2_outside)
                 {
                     throw new Exception(location.ToString());
                 }
             }
             catch (Exception e)
             {
                 if (!catchInInnerHandler)
                 {
                     throw;
                 }
                 Assert.That(e.Message, Is.EqualTo(location.ToString()));
                 return(WorkContext.Stack.ToString());
             }
             if (location == ThrowLocation.main_inside)
             {
                 throw new Exception(location.ToString());
             }
             ctxMain.Done();
         }
         if (location == ThrowLocation.main_outside)
         {
             throw new Exception(location.ToString());
         }
         return(null);
     }
     catch (Exception e)
     {
         Assert.That(e.Message, Is.EqualTo(location.ToString()));
         return(WorkContext.Stack.ToString());
     }
 }