Add Guard

This commit is contained in:
Matt Parker
2025-11-22 12:32:08 +10:00
parent 05744ed96d
commit 3ef03d9c11

View File

@@ -1019,6 +1019,7 @@ public class RoslynAnalysis(ILogger<RoslynAnalysis> logger, BuildService buildSe
private static Project GetProjectForSharpIdeProjectModel(SharpIdeProjectModel projectModel)
{
Guard.Against.Null(projectModel);
var projectsForProjectPath = _workspace!.CurrentSolution.Projects.Where(s => s.FilePath == projectModel.FilePath).ToList();
if (projectsForProjectPath.Count is 0) throw new InvalidOperationException($"No project found in workspace for project path '{projectModel.FilePath}'");
if (projectsForProjectPath.Count is 1)