rubberduck-vba/Rubberduck

Error in "Code Examining"

Closed this issue · 3 comments

Rubberduck version information
Version 2.5.9.6294
Betriebssystem: Microsoft Windows NT 10.0.14393.0, x64
Hostprodukt: Microsoft Office x64
Hostversion: 16.0.14332.20546
Hostprogramm: MSACCESS.EXE

Description
In "Code Examining" Rubberduck names a problem where there isn´t a problem: In a form there is the button cmdGewerke. The error description is that the procedure attached to that button isn´t used. Which is wrong.

To Reproduce
1 Starting Code Examiner

Expected behavior
This "error" isn´t one.

Screenshots
Rubberduck_ProcedureIsntUsed

Logfile
No logfile in the filesystem. Only the directories from a former installation ...

Additional context
Great piece of software with some small bugs. But show me a software with no bugs ....

This one is a deliberate limitation: Rubberduck is not collecting controls in document-type modules, which includes documents in Word, worksheets in Excel, ...and reports and forms in Access. In order to collect these controls we would need host-specific code for each possible host application, and we'd rather not have that.

We could have opted to make the inspection ignore document modules and that would "fix" these false positives, however we deemed it more useful to let it report such false positives because then false negatives would have been a worse outcome.

There's an easy workaround though.

You can mark these handlers as entry points manually using an @EntryPoint annotation comment on top of the handler procedures: the inspection will interpret such annotated members as being used externally, and will no longer report them as "not used".

Fantastic explanation, @retailcoder. Thank you also for the thoughtful workaround.

German abridged Translation for convenience of OP:


Deutsche Übersetzung in verkürzter Fassung :)

Dieses Verhalten ist eine absichtliche Beschränkung der Fähigkeiten von Rubberduck. Wir Analysieren in den Untersuchungen (vielleicht besser Übersetzt als "Inspektionen") keine Kontrollelemente in Dokumentmodulen. Dafür bräuchten wir für jede VBE-Hostanwendung spezifischen Code, und dies wollen wir vermeiden.

Wir hätten in dieser Inspektion solche Dokumentmodule ausklammern können, aber haben uns dagegen entschieden, damit wir akkurater tatsächlich nicht verwendete Prozeduren finden.

Als Abhilfe / Zwischenlösung können solche "Eintrittspunkte" mit der Annotation @Entrypoint markiert werden.