C#: Update the extractor to use the BestOrDefault extension method to choose between multiple locations.

This commit is contained in:
Michael Nebel
2024-06-25 15:50:44 +02:00
parent dd65d960be
commit e15a47d58c
12 changed files with 12 additions and 13 deletions

View File

@@ -27,7 +27,7 @@ namespace Semmle.Extraction
public static Message Create(Context cx, string text, ISymbol symbol, string? stackTrace = null, Severity severity = Severity.Error)
{
return new Message(text, symbol.ToString(), cx.CreateLocation(symbol.Locations.FirstOrDefault()), stackTrace, severity);
return new Message(text, symbol.ToString(), cx.CreateLocation(symbol.Locations.BestOrDefault()), stackTrace, severity);
}
public static Message Create(Context cx, string text, SyntaxNode node, string? stackTrace = null, Severity severity = Severity.Error)