Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyze (csharp) No code found during the build #2082

Open
Subharanjan2055 opened this issue Jan 12, 2024 · 5 comments
Open

Analyze (csharp) No code found during the build #2082

Subharanjan2055 opened this issue Jan 12, 2024 · 5 comments

Comments

@Subharanjan2055
Copy link

Subharanjan2055 commented Jan 12, 2024

Hi ,

I have been trying to build & codescan one dotnet Console applications . Its building the applications but in the perform codeql analysis step its failing and throwing No source code was seen and extracted
Please note only one .cs file is available which is main source code file . How to perform codeql analysis for single file please let me know.

@MathiasVP
Copy link
Contributor

Hi @Subharanjan2055,

How to perform codeql analysis for single file please let me know.

There's nothing special about analysing a single file. If the project builds then we should be able to analyse it.

Do you have a link to a workflow run where the No source code was seen and extracted error appears? If possible, it would be really helpful to have a run with debugging enabled (as this will help our CodeQL engineers figure out what's going on). You can see how to enable debug logging here: https://github.blog/changelog/2022-08-01-debugging-codeql-analysis-in-code-scanning-made-easier-by-obtaining-detailed-logs-and-debugging-artifacts-from-the-codeql-action/

@Subharanjan2055
Copy link
Author

Hi @MathiasVP ,

Before sending debugging log could you please confirm anything do i need to add to my workflow file .

if yes please confirm once & what do i need to add ?

@Subharanjan2055
Copy link
Author

Hi @MathiasVP

The following are the logs that says the following :

Finalizing csharp
C:\uat-runner3_work_tool\CodeQL\0.0.0-20221211\x64\codeql\codeql.exe database finalize --finalize-dataset --threads=4 --ram=14703 C:\uat-runner3_work_temp\codeql_databases\csharp
No source code was seen and extracted to C:\uat-runner3_work_temp\codeql_databases\csharp.
This can occur if the specified build commands failed to compile or process any code.

@Subharanjan2055
Copy link
Author

@MathiasVP Any update ?

@MathiasVP
Copy link
Contributor

You shouldn't need to do anything other than enable debugging as specified in https://github.blog/changelog/2022-08-01-debugging-codeql-analysis-in-code-scanning-made-easier-by-obtaining-detailed-logs-and-debugging-artifacts-from-the-codeql-action/. This will leave a zipped debug artifact attached to your GitHub Actions run. If you unzip that you'll find a "build-tracer.log" file in the "logs" directory. That's the magic sauce we need 🙂

The debug information is necessary for us to investigate whether CodeQL is "picking up" on the compiler invocations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants