protected virtual void VerificationFinished() { try { if (Utility.Utilities.IsValidLicenseAvailable == Utility.Utilities.LicenseType.Evaluation || Utility.Utilities.IsValidLicenseAvailable == Utility.Utilities.LicenseType.Invalid) { if (mAssertion.VerificationOutput.NoOfStates > Utility.Utilities.LicenseBoundedStateNumber) { mListener.updateResFinishedVerify(); mListener.updateStatusLabel(Resources.Verification_Completed); mAssertion.Clear(); //remove the events mAssertion.Action -= mListener.onAction; mAssertion.Cancelled -= Verification_Cancelled; mAssertion.ReturnResult -= VerificationFinished; mAssertion.Failed -= MC_Failed; mListener.enableAllControls(); mTimer.Stop(); return; } } mListener.onAction(mAssertion.GetVerificationStatistics()); mListener.onResult(mAssertion.VerificationOutput.VerificationResult); mListener.updateStatusLabel(Resources.Generating_Result); mAssertion.ReturnResult -= VerificationFinished; mAssertion.ReturnResult += VerificationResult; mAssertion.VerificationOutput.GenerateCounterExample = mListener.generateCounterExample(); mAssertion.VerificationMode = false; mAssertion.Start(); } catch (Exception ex) { mAssertion.Clear(); //remove the events mAssertion.Action -= mListener.onAction; mAssertion.Cancelled -= Verification_Cancelled; mAssertion.ReturnResult -= VerificationFinished; mAssertion.Failed -= MC_Failed; mSpec.AssertionDatabase[mCurAssert] = mAssertion; Common.Utility.Utilities.LogException(ex, mSpec); } // Add by Minh //mListener.RnderingOutputTextbox(); mSpec.UnLockSharedData(); mSpec.UnLockSpecificationData(); }
protected virtual void MC_Failed(object sender, System.Threading.ThreadExceptionEventArgs e) { try { if (e.Exception is RuntimeException) { Common.Ultility.Ultility.LogRuntimeException(e.Exception as RuntimeException); //string trace = ""; //if (e.Exception.Data.Contains("trace")) //{ // trace = Environment.NewLine + "Trace leads to exception:" + Environment.NewLine + e.Exception.Data["trace"].ToString(); //} if (Assertion != null) { TextBox_Output.Text = Assertion.GetVerificationStatistics() + TextBox_Output.Text; TextBox_Output.Text = Assertion.VerificationOutput.ResultString + TextBox_Output.Text; RnderingOutputTextbox(); //TextBox_Output.Text = Resources.Total_transitions_visited_before_the_exception + Assertion.VerificationOutput.Transitions + Environment.NewLine + TextBox_Output.Text; } //TextBox_Output.Text += e.Exception.StackTrace + "\r\n" + TextBox_Output.Text; //TextBox_Output.Text = e.Exception.Message + trace + Environment.NewLine + TextBox_Output.Text; //TextBox_Output.Text = Resources.Exception_happened_during_the_verification + ":\r\n" + TextBox_Output.Text; StatusLabel_Text.Text = Resources.Runtime_Exception_Happened; } else { //if the button is enabled -> the failure is not triggered by cancel action. if (Button_Verify.Enabled) { Common.Ultility.Ultility.LogException(e.Exception, Spec); Spec.UnLockSharedData(); this.Close(); } else { this.StatusLabel_Text.Text = Resources.Verification_Cancelled; } } if (Assertion != null) { Assertion.Clear(); //remove the events Assertion.Action -= OnAction; Assertion.ReturnResult -= VerificationFinished; Assertion.Cancelled -= Verification_Cancelled; Assertion.Failed -= MC_Failed; Assertion = null; } EnableAllControls(); } catch (Exception ex) { Common.Ultility.Ultility.LogException(ex, Spec); //MessageBox.Show("Exception happened: " + ex.Message + "\r\n", // + ex.StackTrace,"PAT", MessageBoxButtons.OK, MessageBoxIcon.Error); } }