Skip to content

Code Inspector should be able to identify parameters that belong to application events and make appropriate code inspection recommendations. #6287

@tnewtonAtDmc

Description

@tnewtonAtDmc

Justification
Currently, Code Inspection does not properly distinguish parameters that belong to application events from standard module processes. As a result, Code Inspection can incorrectly recommend the following fixes which if naively followed will violate the event signature contract and cause a compilation error:

  • Recommend a parameter of an event can be removed because it is not used in the event process.
  • Recommend a parameter of an event can be declared as a ByVal when not assigned.

These will result in violations of event contracts. Without this feature there is potential to confuse developers, especially those who are unfamiliar with the strict signature enforcement.

Description
It's not clear if this is a missing feature or a bug.

Additional context
This was noticed after blindly applying a mass fix on the inspection "ParameterCanBeByVal" while working in Excel. As a result, the program could not compile due to Workbook_BeforeClose(ByVal Cancel As Boolean) being a violation of the signature Workbook_BeforeClose(ByRef Cancel As Boolean) (or simply Workbook_BeforeClose(Cancel As Boolean)) and also due to Workbook_BeforeSave(ByVal SaveAsUI As Boolean, ByVal Cancel As Boolean) being a violation of the signature Workbook_BeforeSave(ByVal SaveAsUI As Boolean, ByRef Cancel As Boolean).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature requests, or enhancements to existing features. Ideas. Anything within the project's scope.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions