We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8dcf792 + e170717 commit 089bb33Copy full SHA for 089bb33
csharp/extractor/Semmle.Extraction.CSharp/Populators/CompilationUnitVisitor.cs
@@ -59,8 +59,15 @@ private void ExtractGlobalStatements(CompilationUnitSyntax compilationUnit)
59
return;
60
}
61
62
- var entryPoint = Cx.Compilation.GetEntryPoint(System.Threading.CancellationToken.None)!;
+ var entryPoint = Cx.Compilation.GetEntryPoint(System.Threading.CancellationToken.None);
63
var entryMethod = Method.Create(Cx, entryPoint);
64
+ if (entryMethod is null)
65
+ {
66
+ Cx.ExtractionError("No entry method found. Skipping the extraction of global statements.",
67
+ null, Cx.CreateLocation(globalStatements[0].GetLocation()), null, Severity.Info);
68
+ return;
69
+ }
70
+
71
var block = GlobalStatementsBlock.Create(Cx, entryMethod);
72
73
for (var i = 0; i < globalStatements.Count; i++)
0 commit comments