Skip to content

Commit dfdd79d

Browse files
authored
Merge pull request #16395 from tamasvajk/buildless/logs1
C#: Add file path to log messages in assets.json parsing
2 parents ef88f3e + 9ce08c5 commit dfdd79d

File tree

1 file changed

+7
-7
lines changed
  • csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching

1 file changed

+7
-7
lines changed

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/Assets.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private record class ReferenceInfo(string? Type, Dictionary<string, object>? Com
7777
/// "json.net"
7878
/// }
7979
/// </summary>
80-
private void AddPackageDependencies(JObject json)
80+
private void AddPackageDependencies(JObject json, string jsonPath)
8181
{
8282
// If there is more than one framework we need to pick just one.
8383
// To ensure stability we pick one based on the lexicographic order of
@@ -91,7 +91,7 @@ private void AddPackageDependencies(JObject json)
9191

9292
if (references is null)
9393
{
94-
logger.LogDebug("No references found in the targets section in the assets file.");
94+
logger.LogDebug($"No references found in the targets section in '{jsonPath}'");
9595
return;
9696
}
9797

@@ -154,7 +154,7 @@ private void AddPackageDependencies(JObject json)
154154
/// "microsoft.netcore.app.ref"
155155
/// }
156156
/// </summary>
157-
private void AddFrameworkDependencies(JObject json)
157+
private void AddFrameworkDependencies(JObject json, string jsonPath)
158158
{
159159

160160
var frameworks = json
@@ -163,7 +163,7 @@ private void AddFrameworkDependencies(JObject json)
163163

164164
if (frameworks is null)
165165
{
166-
logger.LogDebug("No framework section in assets.json.");
166+
logger.LogDebug($"No framework section in '{jsonPath}'.");
167167
return;
168168
}
169169

@@ -177,7 +177,7 @@ private void AddFrameworkDependencies(JObject json)
177177

178178
if (references is null)
179179
{
180-
logger.LogDebug("No framework references in assets.json.");
180+
logger.LogDebug($"No framework references in '{jsonPath}'.");
181181
return;
182182
}
183183

@@ -196,8 +196,8 @@ public bool TryParse(string json)
196196
try
197197
{
198198
var obj = JObject.Parse(json);
199-
AddPackageDependencies(obj);
200-
AddFrameworkDependencies(obj);
199+
AddPackageDependencies(obj, json);
200+
AddFrameworkDependencies(obj, json);
201201
return true;
202202
}
203203
catch (Exception e)

0 commit comments

Comments
 (0)