diff --git a/csharp/ql/lib/semmle/code/csharp/commons/Util.qll b/csharp/ql/lib/semmle/code/csharp/commons/Util.qll index 3b2a166b9adb..9ec3725ed8b7 100644 --- a/csharp/ql/lib/semmle/code/csharp/commons/Util.qll +++ b/csharp/ql/lib/semmle/code/csharp/commons/Util.qll @@ -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", "
$") ) 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"]) + ) and if this.getNumberOfParameters() = 1 then this.getParameter(0).getType().(ArrayType).getElementType() instanceof StringType else this.getNumberOfParameters() = 0