private void ConsistencyCheck()
{
// Checks that we don't have missing or invalid fields
switch (Result)
{
case ExecutionResult.Incomplete:
Debug.Assert(Continuation != null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustHaveContinuation, Result));
Debug.Assert(Exception == null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustNotHaveException, Result));
Debug.Assert(RescheduleIn == null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustNotHaveRescheduleIn, Result));
break;
case ExecutionResult.Completed:
Debug.Assert(Continuation == null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustNotHaveContinuation, Result));
Debug.Assert(Exception == null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustNotHaveException, Result));
break;
case ExecutionResult.Faulted:
Debug.Assert(Continuation == null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustNotHaveContinuation, Result));
Debug.Assert(Exception != null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustHaveException, Result));
break;
case ExecutionResult.Crashed:
Debug.Assert(Continuation == null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustNotHaveContinuation, Result));
Debug.Assert(Exception != null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustHaveException, Result));
Debug.Assert(RescheduleIn == null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustNotHaveRescheduleIn, Result));
break;
case ExecutionResult.Aborted:
Debug.Assert(Continuation == null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustNotHaveContinuation, Result));
Debug.Assert(Exception == null, String.Format(CultureInfo.CurrentCulture, Strings.InvocationResult_ResultMustNotHaveException, Result));
break;
default:
break;
}
}
}