private static void DisableAsserts() { try { //Turn on assert dialog boxes. if (_asserthandler == null) { //Disable the assert pop-up dialogs foreach (TraceListener listener in Debug.Listeners) { if (listener is DefaultTraceListener) { //Disable assert dialogs popups ((DefaultTraceListener)listener).AssertUiEnabled = false; } } //Add our own handler // Note: We can't simply set DefaultTeaceListener.AssertUiEnabled = false, since that // actually disables the assertions, and we no longer see them. We need to count them // as errors and continue in Ltm _asserthandler = new TestLogAssertHandler(); Debug.Listeners.Add(_asserthandler); } } catch (Exception e) { //If disabling the asserts fails, simply log it and move on. //No reason to hold up the test or block error logging for that, and don't count it as an error TestLog.WriteLine("Unable to disable asserts:" + TestLog.NewLine + e); } }
static internal void Dispose() { //Reset the info. _internal = null; if(_asserthandler != null) Debug.Listeners.Remove(_asserthandler); _asserthandler = null; }
static internal void Dispose() { //Reset the info. _internal = null; if (_asserthandler != null) { Debug.Listeners.Remove(_asserthandler); } _asserthandler = null; }
internal static void Dispose() { //Reset the info. s_pinternal = null; s_passerthandler = null; }
private static void DisableAsserts() { try { //Turn on assert dialog boxes. if(_asserthandler == null) { //Disable the assert pop-up dialogs foreach(TraceListener listener in Debug.Listeners) { if(listener is DefaultTraceListener) { //Disable assert dialogs popups ((DefaultTraceListener)listener).AssertUiEnabled = false; } } //Add our own handler // Note: We can't simply set DefaultTeaceListener.AssertUiEnabled = false, since that // actually disables the assertions, and we no longer see them. We need to count them // as errors and continue in Ltm _asserthandler = new TestLogAssertHandler(); Debug.Listeners.Add(_asserthandler); } } catch (Exception e) { //If disabling the asserts fails, simply log it and move on. //No reason to hold up the test or block error logging for that, and don't count it as an error TestLog.WriteLine("Unable to disable asserts:" + TestLog.NewLine + e); } }