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);
}
}
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);
}
}