summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Diagnostics/Assert.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Diagnostics/Assert.cs')
-rw-r--r--src/mscorlib/src/System/Diagnostics/Assert.cs45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/mscorlib/src/System/Diagnostics/Assert.cs b/src/mscorlib/src/System/Diagnostics/Assert.cs
index 9f4b86b7e4..67e6914aa4 100644
--- a/src/mscorlib/src/System/Diagnostics/Assert.cs
+++ b/src/mscorlib/src/System/Diagnostics/Assert.cs
@@ -2,36 +2,37 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-namespace System.Diagnostics {
- using System;
- using System.IO;
- using System.Reflection;
- using System.Runtime.CompilerServices;
- using System.Runtime.Versioning;
- using System.Diagnostics.Contracts;
- using System.Diagnostics.CodeAnalysis;
+using System;
+using System.IO;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.Versioning;
+using System.Diagnostics.Contracts;
+using System.Diagnostics.CodeAnalysis;
+namespace System.Diagnostics
+{
// Class which handles code asserts. Asserts are used to explicitly protect
// assumptions made in the code. In general if an assert fails, it indicates
// a program bug so is immediately called to the attention of the user.
// Only static data members, does not need to be marked with the serializable attribute
internal static class Assert
{
- internal const int COR_E_FAILFAST = unchecked((int) 0x80131623);
+ internal const int COR_E_FAILFAST = unchecked((int)0x80131623);
private static AssertFilter Filter;
static Assert()
{
Filter = new DefaultFilter();
}
-
+
// Called when an assertion is being made.
//
internal static void Check(bool condition, String conditionString, String message)
{
if (!condition)
{
- Fail (conditionString, message, null, COR_E_FAILFAST);
+ Fail(conditionString, message, null, COR_E_FAILFAST);
}
}
@@ -54,9 +55,9 @@ namespace System.Diagnostics {
{
// get the stacktrace
StackTrace st = new StackTrace(numStackFramesToSkip, true);
-
- AssertFilters iResult = Filter.AssertFailure (conditionString, message, st, stackTraceFormat, windowTitle);
-
+
+ AssertFilters iResult = Filter.AssertFailure(conditionString, message, st, stackTraceFormat, windowTitle);
+
if (iResult == AssertFilters.FailDebug)
{
if (Debugger.IsAttached == true)
@@ -66,9 +67,9 @@ namespace System.Diagnostics {
if (Debugger.Launch() == false)
{
throw new InvalidOperationException(
- Environment.GetResourceString("InvalidOperation_DebuggerLaunchFailed"));
- }
- }
+ SR.InvalidOperation_DebuggerLaunchFailed);
+ }
+ }
}
else if (iResult == AssertFilters.FailTerminate)
{
@@ -78,10 +79,10 @@ namespace System.Diagnostics {
Environment._Exit(exitCode);
}
}
-
- // Called when an assert happens.
- // windowTitle can be null.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern static int ShowDefaultAssertDialog(String conditionString, String message, String stackTrace, String windowTitle);
+
+ // Called when an assert happens.
+ // windowTitle can be null.
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static int ShowDefaultAssertDialog(String conditionString, String message, String stackTrace, String windowTitle);
}
}