Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-65209: Bug in AlgorithmBase ?! #157

Open
fubar-coder opened this issue Jun 11, 2018 · 0 comments
Open

CP-65209: Bug in AlgorithmBase ?! #157

fubar-coder opened this issue Jun 11, 2018 · 0 comments

Comments

@fubar-coder
Copy link
Contributor

fubar-coder commented Jun 11, 2018

From unknown CodePlex user on Friday, 02 September 2016 06:35:12

For my Version, I fixed the below in AlgorithmBase.cs (commented out the original code and added PendingAbortion state) and it works fine now when aborting an Algorithm using Abort().

The switch case for PendingAbortion will never be executed if the contract requires Aborted state.

        protected void EndComputation()
        {
            Contract.Requires(
                this.State == ComputationState.Running ||
                this.State == ComputationState.PendingAbortion
                /*this.State == ComputationState.Aborted*/);
            lock (this.syncRoot)
            {
                switch (this.state)
                {
                    case ComputationState.Running:
                        this.state = ComputationState.Finished;
                        this.OnFinished(EventArgs.Empty);
                        break;
                    case ComputationState.PendingAbortion:
                        this.state = ComputationState.Aborted;
                        this.OnAborted(EventArgs.Empty);
                        break;
                    default:
                        throw new InvalidOperationException();
                }
                this.Services.CancelManager.ResetCancel();
                this.OnStateChanged(EventArgs.Empty);
            }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant