You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the issue
An error is emitted when creating a database with the -Obinlog option using a binlog file that does not contain any compilation.
Repro steps:
Download and extract codeql-binlog-min-repro.zip (contains two files: global.json and NoTargetsProject.csproj) to some directory.
In said directory, run msbuild.exe /t:restore;build /bl.
Run codeql.exe database create <database-directory> --language=csharp --build-mode=none -Obinlog=msbuild.binlog
Observe the following error (note that I've generalized some personal file paths):
Initializing database at C:\Users\DSHEPE~1\AppData\Local\Temp\CodeQL_CB_DB2.
Running build command: []
Running command in D:\repos\test: [<path-to-codeql>\codeql\csharp\tools\autobuild.cmd]
[2024-11-13 12:00:24] [build-stdout] CodeQL C# autobuilder
[2024-11-13 12:00:24] [build-stdout] Working directory: D:\repos\test
[2024-11-13 12:00:25] [ERROR] Spawned process exited abnormally (code 2; tried to run: [<path-to-codeql>codeql\tools\win64\runner.exe, cmd.exe, /C, type, NUL, &&, <path-to-codeql>\codeql\csharp\tools\autobuild.cmd])
A fatal error occurred: Exit status 2 from command: [<path-to-codeql>\codeql\tools\win64\runner.exe, cmd.exe, /C, type, NUL, &&, <path-to-codeql>\codeql\csharp\tools\autobuild.cmd]
Can this scenario be treated as a no-op, with just a message emitted that no compilations were found in the binlog?
The other modes (traced, build-mode: none) of the extraction also fail if no source code was seen during the extraction, so I'm somewhat hesitant to do this. What is the reason that you'd like this to succeed and to get an empty database?
I'm using the -Obinlog option to automate CodeQL database creation for arbitrary csproj's, the builds of which aren't guaranteed to invoke Csc.exe. Instead of me having to add logic to load and parse the binlog file myself to verify that Csc.exe was in fact invoked and, if it is, have codeql load and parse the binlog file again, a much better approach would be to have codeql just create an empty database and (maybe) emit an appropriate message.
Description of the issue
An error is emitted when creating a database with the
-Obinlog
option using abinlog
file that does not contain any compilation.Repro steps:
global.json
andNoTargetsProject.csproj
) to some directory.msbuild.exe /t:restore;build /bl
.codeql.exe database create <database-directory> --language=csharp --build-mode=none -Obinlog=msbuild.binlog
Can this scenario be treated as a no-op, with just a message emitted that no compilations were found in the binlog?
cc: @tamasvajk
The text was updated successfully, but these errors were encountered: