public void StartDebug(IProject project)
{
if (project?.Debugger != null)
{
Project = project;
Task.Factory.StartNew(async () =>
{
await project.ToolChain.Build(_console, project);
//Debugger.DebugMode = true;
project.Debugger.Initialise();
_console.WriteLine();
_console.WriteLine("Starting Debugger...");
if (await project.Debugger.StartAsync(project.ToolChain, _console, project))
{
Dispatcher.UIThread.InvokeAsync(() =>
{
if (DebugSessionStarted != null)
{
DebugSessionStarted(this, new EventArgs());
}
_shell.CurrentPerspective = Perspective.Debug;
});
CurrentDebugger = project.Debugger;
await BreakPointManager.GoLiveAsync();
await BreakPointManager.Add(await CurrentDebugger.BreakMainAsync());
await CurrentDebugger.RunAsync();
}
else
{
_console.WriteLine("Unable to connect to debugger.");
ResetDebugSession();
}
});
}
else
{
_console.WriteLine("No debugger selected.");
}
}