refactor creation of debugger process

This commit is contained in:
Matt Parker
2026-01-06 19:15:49 +10:00
parent 60e7f9d650
commit 50fdf68bd1
6 changed files with 54 additions and 27 deletions

View File

@@ -0,0 +1,7 @@
namespace SharpIDE.Application.Features.Run;
public readonly record struct DebuggerExecutableInfo
{
public required bool UseInMemorySharpDbg { get; init; }
public required string? DebuggerExecutablePath { get; init; }
}

View File

@@ -22,7 +22,7 @@ public partial class RunService(ILogger<RunService> logger, RoslynAnalysis rosly
private readonly ILogger<RunService> _logger = logger;
private readonly RoslynAnalysis _roslynAnalysis = roslynAnalysis;
public async Task RunProject(SharpIdeProjectModel project, bool isDebug = false, string? debuggerExecutablePath = null)
public async Task RunProject(SharpIdeProjectModel project, bool isDebug = false, DebuggerExecutableInfo? debuggerExecutableInfo = null)
{
Guard.Against.Null(project, nameof(project));
Guard.Against.NullOrWhiteSpace(project.FilePath, nameof(project.FilePath), "Project file path cannot be null or empty.");
@@ -93,7 +93,7 @@ public partial class RunService(ILogger<RunService> logger, RoslynAnalysis rosly
// Attach debugger (which internally uses a DiagnosticClient to resume startup)
var debugger = new Debugger { Project = project, ProcessId = process.ProcessId };
_debugger = debugger;
await debugger.Attach(debuggerExecutablePath, Breakpoints.ToDictionary(), project, project.RunningCancellationTokenSource.Token).ConfigureAwait(false);
await debugger.Attach(debuggerExecutableInfo, Breakpoints.ToDictionary(), project, project.RunningCancellationTokenSource.Token).ConfigureAwait(false);
}
project.Running = true;