title: how to use IronPython to debug the Script step by step?
body: <p>I'm working on a project in which I am creating a IronPython compiler depend on IronPython ,
  But I have some problem on debugging the Script and can use breakpoint ? could you please give me some help ? thanks. all my code is there: [<a href="https://github.com/heyxEvget/IronPython-Debugger]" rel="nofollow">https://github.com/heyxEvget/IronPython-Debugger]</a></p>
  
  <pre><code>  public ScriptEngine GetEngine()
      {
          if (_engine != null)
              return _engine;
          _engine = Python.CreateEngine();
          _engine.Runtime.IO.SetOutput(_stream, Encoding.UTF8);
          _engine.Runtime.IO.SetErrorOutput(_stream, Encoding.UTF8);
          string path = Environment.CurrentDirectory;
          string ironPythonLibPath = string.Format(@"{0}\IronPythonLib.zip", path);
          var paths = _engine.GetSearchPaths() as List&lt;string&gt; ?? new List&lt;string&gt;();
          paths.Add(path);
          paths.Add(ironPythonLibPath);
          path = Environment.GetEnvironmentVariable("IRONPYTHONPATH");
          if (!string.IsNullOrEmpty(path))
          {
              var pathStrings = path.Split(';');
              paths.AddRange(pathStrings.Where(p =&gt; p.Length &gt; 0));
          }
          _engine.SetSearchPaths(paths.ToArray());
          return _engine;
      }
  
      private void GetPythonVarsInfo(ScriptScope scope)
      {
          _varList.Clear();
          var items = scope.GetItems();
          foreach (var item in items)
          {
              _varList.Add(new VarValue
              {
                  VarName = item.Key,
                  Value = item.Value
              });
          }
          valueListView.ItemsSource = _varList;
      }
  
      private void OnExecuteButtonClick(object sender, ItemClickEventArgs e)
      {
          string outPutString = string.Empty;
          outPutString = "*************************************" +
              "Excute Date: " + DateTime.Now.ToLocalTime().ToString(CultureInfo.InvariantCulture);
          ExeceutePython(document, outPutString);
          TabControl.SelectedIndex = 2;
      }
  
      private void ExeceutePython(EditorDocument document, string outPutString)
      {
          ScriptEngine engine = GetEngine();
          string script = document.Text;
          ScriptSource source = engine.CreateScriptSourceFromString(script);
          ScriptScope scope = _engine.CreateScope();
          try
          {
              source.Compile();
              OutputTextBox.AppendText(outPutString + Environment.NewLine);
              var result = source.Execute(scope);
              if (result != null)
              {
                  OutputTextBox.AppendText(engine.Operations.Format(result));
              }
              OutputTextBox.AppendText(Environment.NewLine);
              GetPythonVarsInfo(scope);
          }
          catch (Exception ex)
          {
              var eo = engine.GetService&lt;ExceptionOperations&gt;();
              var eoString = eo.FormatException(ex);
              OutputTextBox.AppendText(eoString);
              return;
          }
      }
  </code></pre>