public static void End(string name)
 {
     if (MonitoredScope.TraceMonitoredScope)
     {
         MonitoredScope monitoredScope = MonitoredScope.instance;
         if (!string.Equals(monitoredScope.stack.Peek().Key, name, StringComparison.InvariantCulture))
         {
             throw new Exception("MonitoredScope cannot be ended because the start and end scope names do not match!");
         }
         monitoredScope.Dispose();
     }
 }