do not run project on failed build
This commit is contained in:
@@ -33,15 +33,23 @@ public partial class RunService(ILogger<RunService> logger, RoslynAnalysis rosly
|
||||
var semaphoreSlim = _projectLocks.GetOrAdd(project, new SemaphoreSlim(1, 1));
|
||||
var waitResult = await semaphoreSlim.WaitAsync(0).ConfigureAwait(false);
|
||||
if (waitResult is false) throw new InvalidOperationException($"Project {project.Name} is already running.");
|
||||
if (project.RunningCancellationTokenSource is not null) throw new InvalidOperationException($"Project {project.Name} is already running with a cancellation token source.");
|
||||
project.RunningCancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
await _buildService.MsBuildAsync(project.FilePath);
|
||||
|
||||
var launchProfiles = await LaunchSettingsParser.GetLaunchSettingsProfiles(project);
|
||||
var launchProfile = launchProfiles.FirstOrDefault();
|
||||
try
|
||||
{
|
||||
if (project.RunningCancellationTokenSource is not null) throw new InvalidOperationException($"Project {project.Name} is already running with a cancellation token source.");
|
||||
|
||||
var buildResult = await _buildService.MsBuildAsync(project.FilePath);
|
||||
if (buildResult is not SharpIdeBuildResult.Success)
|
||||
{
|
||||
_logger.LogInformation("Build failed for project {ProjectName}. Aborting run/debug.", project.Name);
|
||||
return;
|
||||
}
|
||||
|
||||
project.RunningCancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
var launchProfiles = await LaunchSettingsParser.GetLaunchSettingsProfiles(project);
|
||||
var launchProfile = launchProfiles.FirstOrDefault();
|
||||
|
||||
var fileName = launchProfile?.CommandName switch
|
||||
{
|
||||
"Executable" => launchProfile.ExecutablePath,
|
||||
|
||||
Reference in New Issue
Block a user