/// <summary> /// This method is called on a worker thread (via asynchronous /// delegate invocation). This is where we call the operation (as /// defined in the deriving class's DoWork method). /// </summary> public void InternalStart() { // Reset our state - we might be run more than once. cancelledFlag = false; completeFlag = false; cancelAcknowledgedFlag = false; failedFlag = false; // isRunning is set during Start to avoid a race condition try { if (VerificationMode) { //start the timer and memory checking VerificationOutput.StartVerification(); PrintMessage("Verification starts...."); //this checking to skip the verification for the pre-determined result: as in the LTL assertions. if (VerificationOutput.VerificationResult == VerificationResultType.UNKNOWN) { ModelChecking(); } PrintMessage("Verification ends...."); } else { VerificationOutput.ResultString = GetResultString(); } // When a cancel occurs, the recursive DoSearch drops back // here asap, so we'd better acknowledge cancellation. if (CancelRequested) { VerificationOutput.ResultString = GetResultStringForUnfinishedSearching(null); AcknowledgeCancel(); } else { OnReturnResult(); } } catch (CancelRunningException) { AcknowledgeCancel(); } catch (Exception e) { // Raise the Failed event. We're in a catch handler, so we // had better try not to throw another exception. try { if (e is System.OutOfMemoryException) { e = new Expressions.ExpressionClass.OutOfMemoryException(""); } if (VerificationOutput.CounterExampleTrace != null && VerificationOutput.CounterExampleTrace.Count > 0) { StringBuilder sb = new StringBuilder(); VerificationOutput.GetCounterxampleString(sb); //this.GetCounterxampleString(sb); e.Data.Add("trace", sb.ToString()); } VerificationOutput.ResultString = GetResultStringForUnfinishedSearching(e); FailOperation(e); } catch { } // The documentation recommends not catching // SystemExceptions, so having notified the caller we // rethrow if it was one of them. if (e is SystemException) { throw; } } finally { } lock (this) { // If the operation wasn't cancelled (or if the UI thread // tried to cancel it, but the method ran to completion // anyway before noticing the cancellation) and it // didn't fail with an exception, then we complete the // operation - if the UI thread was blocked waiting for // cancellation to complete it will be unblocked, and // the Completion event will be raised. if (!cancelAcknowledgedFlag && !failedFlag) { CompleteOperation(); } } }