joernio / joern

Open-source code analysis platform for C/C++/Java/Binary/Javascript/Python/Kotlin based on code property graphs. Discord https://discord.gg/vv4MH284Hc
https://joern.io/
Apache License 2.0
1.97k stars 268 forks source link

[Bug] help~C# DotNetAstGenRunner:- running dotnetastgen failed! #4663

Open wozhendeshuai opened 3 months ago

wozhendeshuai commented 3 months ago

Describe the bug When I want to use joern to parse a C# code, the following error occurs:


(my_venv)@-Pro % joern-parse /xxxxxxx/src/CommandLine/Infrastructure/                         
Parsing code at: /xxxxxxx/CommandLine/Infrastructure/ - language: `CSHARPSRC`
[+] Running language frontend
Invoking CPG generator in a separate process. Note that the new process will consume additional memory.
If you are importing a large codebase (and/or running into memory issues), please try the following:
1) exit joern
2) invoke the frontend: /opt/homebrew/Cellar/joern/2.0.260/libexec/csharpsrc2cpg 

2024-06-13 15:03:12.982 ERROR DotNetAstGenRunner:       - running dotnetastgen failed!
java.lang.RuntimeException: 
        at io.joern.x2cpg.utils.ExternalCommand.handleRunResult(ExternalCommand.scala:22) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.utils.ExternalCommand.handleRunResult$(ExternalCommand.scala:8) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.utils.ExternalCommand$.handleRunResult(ExternalCommand.scala:39) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.utils.ExternalCommand.run(ExternalCommand.scala:34) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.utils.ExternalCommand.run$(ExternalCommand.scala:8) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.utils.ExternalCommand$.run(ExternalCommand.scala:39) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.csharpsrc2cpg.utils.DotNetAstGenRunner.runAstGenNative(DotNetAstGenRunner.scala:67) ~[io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.astgen.AstGenRunnerBase.execute(AstGenRunner.scala:181) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.astgen.AstGenRunnerBase.execute$(AstGenRunner.scala:83) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.csharpsrc2cpg.utils.DotNetAstGenRunner.execute(DotNetAstGenRunner.scala:17) ~[io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.csharpsrc2cpg.CSharpSrc2Cpg.createCpg$$anonfun$1$$anonfun$1(CSharpSrc2Cpg.scala:30) ~[io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15) ~[org.scala-lang.scala3-library_3-3.3.1.jar:3.3.1]
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10) ~[org.scala-lang.scala3-library_3-3.3.1.jar:3.3.1]
        at better.files.Dispose.apply(Dispose.scala:75) ~[com.github.pathikrit.better-files_3-3.9.2.jar:3.9.2]
        at better.files.Dispose.foreach(Dispose.scala:91) ~[com.github.pathikrit.better-files_3-3.9.2.jar:3.9.2]
        at better.files.File$.usingTemporaryDirectory(File.scala:1320) ~[com.github.pathikrit.better-files_3-3.9.2.jar:3.9.2]
        at io.joern.csharpsrc2cpg.CSharpSrc2Cpg.createCpg$$anonfun$1(CSharpSrc2Cpg.scala:37) ~[io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at scala.runtime.function.JProcedure2.apply(JProcedure2.java:15) ~[org.scala-lang.scala3-library_3-3.3.1.jar:3.3.1]
        at scala.runtime.function.JProcedure2.apply(JProcedure2.java:10) ~[org.scala-lang.scala3-library_3-3.3.1.jar:3.3.1]
        at io.joern.x2cpg.X2Cpg$.withNewEmptyCpg$$anonfun$1$$anonfun$1(X2Cpg.scala:279) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.X2Cpg$.$anonfun$adapted$1(X2Cpg.scala:280) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at scala.util.Try$.apply(Try.scala:210) ~[org.scala-lang.scala-library-2.13.10.jar:?]
        at io.joern.x2cpg.X2Cpg$.withNewEmptyCpg$$anonfun$1(X2Cpg.scala:280) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at scala.util.Try$.apply(Try.scala:210) ~[org.scala-lang.scala-library-2.13.10.jar:?]
        at io.joern.x2cpg.X2Cpg$.withNewEmptyCpg(X2Cpg.scala:286) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.csharpsrc2cpg.CSharpSrc2Cpg.createCpg(CSharpSrc2Cpg.scala:38) ~[io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.csharpsrc2cpg.CSharpSrc2Cpg.createCpg(CSharpSrc2Cpg.scala:27) ~[io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.X2CpgFrontend.run$$anonfun$1(X2Cpg.scala:138) ~[io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.X2Cpg$.withErrorsToConsole(X2Cpg.scala:293) [io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.X2CpgFrontend.run(X2Cpg.scala:144) [io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.X2CpgFrontend.run$(X2Cpg.scala:126) [io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.csharpsrc2cpg.CSharpSrc2Cpg.run(CSharpSrc2Cpg.scala:24) [io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.csharpsrc2cpg.Main$.run(Main.scala:38) [io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.csharpsrc2cpg.Main$.run(Main.scala:35) [io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.x2cpg.X2CpgMain.main(X2Cpg.scala:109) [io.joern.x2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
        at io.joern.csharpsrc2cpg.Main.main(Main.scala) [io.joern.csharpsrc2cpg-HEAD+20240318-1646.jar:HEAD+20240318-1646]
[+] Applying default overlays
Successfully wrote graph to: /xxxxxxx/cpg.bin
To load the graph, type `joern /xxxxxxx/cpg.bin`

When I exported PDG, no files were generated

Desktop (please complete the following information):

Additional context

At the same time, I have another question, why when I export PDG、AST、CPG14, there are many dot files generated in one folder, why not just one? Is there any relevant document?

image

wozhendeshuai commented 3 months ago

anyone?thanks