private void RunWithDebuggerGuts() // On background thread, no UI access.
        {
            try
            {
                switch (workerParams.RequestedRunMode)
                {
                case RunMode.RunTo:
                    workerParams.CurrentVmState = debugRunner.Run();
                    break;

                case RunMode.StepNext:
                    workerParams.CurrentVmState = debugRunner.StepOver();
                    break;

                case RunMode.StepIn:
                    workerParams.CurrentVmState = debugRunner.Step();
                    break;

                case RunMode.StepOut:
                    workerParams.CurrentVmState = debugRunner.StepOut();
                    break;

                default:
                {
                    string runMode = workerParams.RequestedRunMode.ToString();
                    throw new InvalidOperationException("Unsupported RunMode: " + runMode);
                }
                }
            }
            catch (Exception exception)
            {
                switch (exception.GetType().ToString())
                {
                case "ProtoScript.Runners.DebugRunner+EndofScriptException":
                case "ProtoScript.Runners.DebugRunner.EndofScriptException":
                case "ProtoScript.Runners.DebugRunner+RunnerNotInitied":
                    workerParams.ExecutionEnded = true;
                    break;

                default:
                    workerParams.ExecException = exception;
                    break;
                }
            }
        }