Skip to content

Commit e560ac1

Browse files
committed
C#: Tracer support for invoking csc directly.
1 parent 9efa20d commit e560ac1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Extractor/CompilerVersion.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ public CompilerVersion(Options options)
7474
specifiedFramework = compilerDir;
7575
}
7676

77-
var versionInfo = FileVersionInfo.GetVersionInfo(SpecifiedCompiler);
77+
// If csc is specified as compiler name, then attempt to read the version information from csc.dll
78+
var compilerBinaryName = SpecifiedCompiler.EndsWith("csc") ? $"{SpecifiedCompiler}.dll" : SpecifiedCompiler;
79+
var versionInfo = FileVersionInfo.GetVersionInfo(compilerBinaryName);
7880
if (!knownCompilerNames.TryGetValue(versionInfo.OriginalFilename ?? string.Empty, out var vendor))
7981
{
8082
SkipExtractionBecause("the compiler name is not recognised");

csharp/tools/tracing-config.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ function RegisterExtractorPack(id)
226226
prepend = { '--compiler', '"${compiler}"' },
227227
order = ORDER_BEFORE
228228
}),
229+
CreatePatternMatcher({ '^csc$' }, MatchCompilerName,
230+
extractor, {
231+
prepend = { '--compiler', '${compiler}' },
232+
order = ORDER_BEFORE
233+
}),
229234
MsBuildMatcher,
230235
function(compilerName, compilerPath, compilerArguments, _languageId)
231236
-- handle cases like `dotnet exec csc.dll <args>` and `mono(-sgen64) csc.exe <args>`

0 commit comments

Comments
 (0)