Host Specific Expression

Warns about host-evaluated square-bracketed expressions.

Reasoning

Host-evaluated expressions should be implementable using the host application's object model. If the expression yields an object, member calls against that object are late-bound.

Default severity

Warning

Inspection type

LanguageOpportunities

Examples

This example should trigger a result

MyModule (StandardModule)
Public Sub DoSomething() [A1].Value = 42 End Sub

This example should NOT trigger a result

MyModule (StandardModule)
Public Sub DoSomething() ActiveSheet.Range("A1").Value = 42 End Sub

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