public static void RunWithWriteLock(Action action) { Exception actionException = null; #if !RESHARPER_31 TestShell.RunGuarded(delegate { using (WriteLockCookie.Create()) { #endif try { action(); } catch (Exception ex) { actionException = ex; } #if !RESHARPER_31 } }); #endif if (actionException != null) ExceptionUtils.RethrowWithNoStackTraceLoss(actionException); }
private void AddDecorator(ActionChain <PatternTestInstanceState> chain) { chain.Around(delegate(PatternTestInstanceState childState, Action <PatternTestInstanceState> inner) { TestShell.RunGuarded(delegate { using (ReadLockCookie.Create()) { inner(childState); } }); }); }