Inspection Details

ObjectWhereProcedureIsRequired


Summary
Identifies places in which an object is used but a procedure is required and a default member exists on the object.
Reasoning
Providing an object where a procedure is required leads to an implicit call to the object's default member. This behavior is not obvious, and most likely unintended.
The following code example(s) would trigger this inspection:
Class1

Public Function Foo() As Long
    Attibute Foo.VB_UserMemId = 0
    Foo = 42
End Function

Module

Public Sub DoSomething(ByVal arg As Class1)
    arg
End Sub

The following code example(s) would not trigger this inspection:
Class1

Public Function Foo() As Long
    Attibute Foo.VB_UserMemId = 0
    Foo = 42
End Function

Module

Public Sub DoSomething(ByVal arg As Class1)
    arg.Foo
End Sub


Back to List