Indexed Unbound Default Member Access

Identifies the use of indexed default member accesses for which the default member cannot be determined at compile time.

Reasoning

An indexed default member access hides away the actually called member. This is especially problematic if the default member cannot be determined from the declared type of the object. Should there not be a suitable default member at runtime, an error 438 'Object doesn't support this property or method' will be raised.

Default severity

Warning

Inspection type

CodeQualityIssues

Examples

This example should trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal rst As Object) Dim bar As Variant bar = rst("MyField") End Sub

This example should NOT trigger a result

MyModule (StandardModule)
Public Sub DoSomething(ByVal rst As Object) Dim bar As Variant bar = rst.Fields.Item("MyField") End Sub

Rubberduck.CodeAnalysis.Inspections.Concrete.IndexedUnboundDefaultMemberAccessInspection.cs (Prerelease-v2.5.9.6289)