Skip to content

Commit 4d8f150

Browse files
committed
C#: Allow virtual method/indexer/property/event access in nameof expressions in cs/virtual-call-in-constructor.
1 parent be6f771 commit 4d8f150

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

csharp/ql/src/Bad Practices/VirtualCallInConstructorOrDestructor.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ predicate virtualCallToSelfInConstructor(Expr e) {
1919
(c instanceof Constructor or c instanceof Destructor) and
2020
t = c.getDeclaringType() and
2121
virtualAccessWithThisQualifier(e, d) and
22+
not e = any(NameOfExpr ne).getAccess().getAChildExpr*() and
2223
t.getABaseType*() = d.getDeclaringType() and
2324
not t.isSealed() and
2425
not overriddenSealed(t.getABaseType*(), d)

0 commit comments

Comments
 (0)