Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion csharp/ql/lib/semmle/code/csharp/commons/Util.qll
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ class MainMethod extends Method {
(
this.hasName("Main")
or
// generated by the C# compiler for executables utilizing top-level statements
this.hasFullyQualifiedName("Program", "<Main>$")
) and
this.isStatic() and
(this.getReturnType() instanceof VoidType or this.getReturnType() instanceof IntType) and
(
this.getReturnType() instanceof VoidType
or
this.getReturnType() instanceof IntType
or
this.getReturnType().hasFullyQualifiedName("System.Threading.Tasks", ["Task", "Task<System.Int32>"])
) and
if this.getNumberOfParameters() = 1
then this.getParameter(0).getType().(ArrayType).getElementType() instanceof StringType
else this.getNumberOfParameters() = 0
Expand Down