Skip to content

Commit 79ba700

Browse files
brettfoCopilot
andcommitted
Check ProjectAssetsFile exists before reading
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 295f2bd commit 79ba700

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,11 @@ ILogger logger
518518
{
519519
if (propertiesForProject.TryGetValue("ProjectAssetsFile", out var assetsFilePath))
520520
{
521+
if (!File.Exists(assetsFilePath))
522+
{
523+
throw new FileNotFoundException("The file specified at $(ProjectAssetsFile) does not exist.");
524+
}
525+
521526
var assetsContent = File.ReadAllText(assetsFilePath);
522527
var assets = JsonDocument.Parse(assetsContent).RootElement;
523528
return assets;

0 commit comments

Comments
 (0)