From 88e67715a143323a1bfde1c985d0c18ee84b7a48 Mon Sep 17 00:00:00 2001 From: Tamas Vajk Date: Wed, 24 Apr 2024 11:53:26 +0200 Subject: [PATCH] C#: Do not download `Microsoft.CodeAnalysis.ResxSourceGenerator` when there are no `resx` files to process --- .../SourceGenerators/ResxGenerator.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/SourceGenerators/ResxGenerator.cs b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/SourceGenerators/ResxGenerator.cs index 3c99350a9de..ff24bf0ea6f 100644 --- a/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/SourceGenerators/ResxGenerator.cs +++ b/csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/SourceGenerators/ResxGenerator.cs @@ -19,6 +19,13 @@ namespace Semmle.Extraction.CSharp.DependencyFetching TemporaryDirectory tempWorkingDirectory, IEnumerable references) : base(fileProvider, fileContent, dotnet, compilationInfoContainer, logger, tempWorkingDirectory, references) { + if (fileProvider.Resources.Count == 0) + { + logger.LogDebug("No resources found, skipping resource extraction."); + sourceGeneratorFolder = null; + return; + } + try { // The package is downloaded to `missingpackages`, which is okay, we're already after the DLL collection phase.