Fixed Assumes class to be more debugger friendly.

This commit is contained in:
Andrew Arnott 2012-07-14 11:07:25 -07:00
Родитель 761d80ab69
Коммит 415d40a377
2 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -27,6 +27,7 @@ namespace Microsoft
/// <summary>
/// Initializes a new instance of the <see cref="InternalErrorException"/> class.
/// </summary>
[DebuggerStepThrough]
public InternalErrorException(string message = null, bool showAssert = true)
: base(message ?? Strings.InternalExceptionMessage)
{
@ -36,6 +37,7 @@ namespace Microsoft
/// <summary>
/// Initializes a new instance of the <see cref="InternalErrorException"/> class.
/// </summary>
[DebuggerStepThrough]
public InternalErrorException(string message, Exception innerException, bool showAssert = true)
: base(message ?? Strings.InternalExceptionMessage, innerException)
{
@ -45,6 +47,7 @@ namespace Microsoft
/// <summary>
/// Initializes a new instance of the <see cref="InternalErrorException"/> class.
/// </summary>
[DebuggerStepThrough]
protected InternalErrorException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
@ -58,6 +61,7 @@ namespace Microsoft
/// The assertion dialog may yet be suppressed if
/// ((DefaultTraceListener)System.Diagnostics.Trace.Listeners["Default"]).AssertUiEnabled == false
/// </remarks>
[DebuggerStepThrough]
private void ShowAssertDialog(bool showAssert)
{
if (showAssert)

Просмотреть файл

@ -190,13 +190,16 @@ namespace Microsoft
/// Throws an public exception.
/// </summary>
/// <returns>Nothing, as this method always throws. The signature allows for "throwing" Fail so C# knows execution will stop.</returns>
[DebuggerStepThrough]
public static Exception Fail(string message = null, bool showAssert = true)
{
// Keep these two as separate lines of code, so the debugger can come in during the assert dialog
// that the exception's constructor displays, and the debugger can then be made to skip the throw
// in order to continue the investigation.
var exception = new InternalErrorException(message, showAssert);
throw exception;
bool continueToThrow = true; // allows debuggers to skip throwing.
if (continueToThrow) {
throw exception;
} else {
return null;
}
}
/// <summary>