Inspection Details

ImplicitUnboundDefaultMemberAccess


Summary
Identifies the use of indexed default member accesses for which the default member cannot be determined at compile time.
Reasoning
Default member accesses hide away the actually called member. This is especially misleading if there is no indication in the expression that such a call is made and if the default member cannot be determined from the declared type of the object. As a consequence, errors in which a member was forgotten to be called can go unnoticed and should there not be a suitable default member at runtime, an error 438 'Object doesn't support this property or method' will be raised.
The following code example(s) would trigger this inspection:

Public Sub DoSomething(ByVal arg As Object)
    Dim bar As Variant
    bar = arg
End Sub

Public Sub DoSomething(ByVal arg As Object)
    Dim bar As Variant
    arg = bar
End Sub

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

Public Sub DoSomething(ByVal arg As Object)
    Dim bar As Variant
    bar = arg.SomeValueReturningMember
End Sub

Public Sub DoSomething(ByVal arg As Object)
    Dim bar As Variant
    arg.SomePropertyLet = bar
End Sub


Back to List