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
C sharp build is failing after enabling AdvancedSecurity-Codeql-Init@1 #15679
Comments
|
Looks like the same as https://github.com/github/code-scanning/issues/13024. There the conclusion from @tamasvajk was:
However, now it appears that the build actually breaks. @tamasvajk can you take a look? |
|
I think these might be two separate issues:
As @hvitved mentioned, these are safe to ignore.
|
|
Hi @tamasvajk Thanks for the quick response !! I tried what you mentioned without GHAS task and YES the build is failing if I set the property |
|
ASP.NET MVC is compiling the view files on the fly when the first request comes in. If your view file contained a compiler error, the user would face the server error page. |
|
I am not seeing any errors in the view files. @tamasvajk I tried running it with /p:MvcBuildViews=false and adding GHAS task but it fails still. (just an update may not be relevant) |
Can you share the compiler errors? Could you share the lines of the generated files in |
|
@tamasvajk As I trace back to the line number mentioned in the error, below are some of the lines I can provide you.
Errors are starting from line number 44 till 583. |
|
The compiler error is reported in a generated |
|
I was building the code on ADO and the VMs were temporary, I tried running it with an agent which has windows-2019 server and giving only one error and failing but the error is still same. |
|
That From CodeQL perspective, you could try to disable the view building, but it's somewhat cumbersome. See more details here: https://github.com/advanced-security/advanced-security-material/blob/main/troubleshooting/codeql-builds/compiled-languages-csharp.md#mvcbuildviews-target-failures. |
I'm not sure I understand your question. The condition
In essence it's a correct summary. Some extensions to it: I'm not sure we concluded that "it breaks due to some misconfigurations in our .csproj". It could also be the case that the CI environment is configured differently than your production system, so view compilation fails on one system, but not on the other. Also, it's not a mandatory step for CodeQL, it's simply the default CodeQL behavior that we inject the
Yes, this is correct. |


I am trying to run the codeql scan on a azure devops repo, with the steps defined in the official documentation.
Without putting GHAS task inside the yaml file build is successful, as soon as I introduce the module it fails.
This is the warning I get in logs after enabling GHAS in my pipeline which was not there earlier.
##[warning]c:\program files\microsoft visual studio\2022\enterprise\msbuild\current\bin\Roslyn\Microsoft.Managed.Core.targets(336,5): Warning : EmitCompilerGeneratedFiles was true, but no CompilerGeneratedFilesOutputPath was provided. CompilerGeneratedFilesOutputPath must be set in order to emit generated files.
After that there are more than 100 errors stating the below which were not there earlier.
##[error]c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\temp\662ac91c\e2d2875f\App_Web_fe22zids.0.cs(44,0): Error CS0103: The name 'Context' does not exist in the current context
I am not changing anything in the successful build apart from adding the steps needed to run GHAS on ADO.
Please provide your insights, Thank you
The text was updated successfully, but these errors were encountered: