Version 2.5.1 was released August 22, 2020. Since then, the installer was downloaded over 11,600 times; we are now 420 commits and 650 modified files later, and the time has come to deliver all that work into a convenient little installer package and move on to the next dev/release cycle.
If you’ve kept up with latest pre-release builds (especially in the last few weeks), nothing much. If you’ve been patiently waiting for the next release, you’re in for a treat!
The first thing you’ll probably notice is the shiny new splash screen design:
It’s the same old yellow splash made with Paint.NET, with a tiled reflection distortion effect against the background, a semi-transparent white bottom panel, and a finer font. Do you like it?
50-some issues labelled “bug” were closed between 2020-08-22 and mid-April 2021, many of them thanks to flicking the switch on leveraging our internal
ITypeLib API for user code – thanks to earlier invaluable contributions from the amazing Wayne Phillips (vbWatchdog, twinBASIC), Rubberduck is now able to tap into the actual in-memory COM type library compiled from the VBA code and, eventually, fill the remaining the gaps in Rubberduck’s understanding of the code: Rubberduck now understands enough to be able to tell that
ThisWorkbook has a
_Workbook subtype, and that
Sheet1 has a
_Worksheet subtype, …and that’s enough to identify the
ThisWorkbook module at long last, and as a result Rubberduck’s ImplicitActiveSheetReference and ImplicitActiveWorkbookReference inspections get to work exactly as intended, and the door is now opened for so many interesting things…
A Rubberduck release wouldn’t be a Rubberduck release without at least a handful of new inspections. The IllegalAnnotation inspection is being replaced by InvalidAnnotation, UnrecognizedAnnotation, and together with the new AnnotationInIncompatibleComponentType inspection they allow Rubberduck to better convey exactly what’s wrong with a given “illegal” annotation comment.
Some annotations cannot be used in certain types of modules. For example, attribute-related annotations cannot be used in document modules (because Rubberduck cannot import back the modified modules), and a
@TestModule annotation is only meaningful in a standard module.
Note that the
@VariableDescription annotations do work in document modules now, because Rubberduck is now reading docstrings off annotations rather than hidden attributes.
Code in the
ThisWorkbook module (Excel) referring to members of the
Workbook class, have an implicit
Me qualifier. This makes an unqualified
Worksheets(1) retrieval in
ThisWorkbook refer to
ThisWorkbook.Worksheets(1), but an identical statement in any other module would be (implicitly) referring to
ActiveWorkbook. By qualifying such member calls with
Me, the intent is clarified.
Code in a worksheet module (Excel) referring to members of the
Worksheet class, have an implicit
Me qualifier. This makes an unqualified
Range member call in the
Sheet2 module refer to
Sheet2, but an identical statement in any other module would be (implicitly) referring to
ActiveSheet. By qualifying such member calls with
Me, the intent is clarified.
Flags unbound annotations; that is, annotation comments that were correctly parsed as Rubberduck annotations but that could not be associated with a target element. This would happen when a module annotation is used in local scope, or a member annotation at module level. This inspection only flags annotation comments that parsed as Rubberduck annotations.
The RHS/Value parameter of a
Property Let procedure is always passed by value. As such, an explicit
ByRef modifier on such a parameter definition is misleading. From MS-VBAL (VBA language specifications) section 220.127.116.11 Property Declarations:
§ If the <value-param> of a <property-LHS-declaration> does not have a <parameter-mechanism> element or has a <parameter-mechanism> consisting of the keyword ByRef, it has the same meaning as if it instead had a <parameter-mechanism> element consisting of the keyword ByVal.
§ The <value-param> of a <property-LHS-declaration> always has the runtime semantics of a ByVal parameter.
This inspection flags comments that parsed like a Rubberduck annotation, but aren’t recognized or supported. It picks up typos in Rubberduck annotations, and annotation-like comments that aren’t Rubberduck annotations but parse as such. Splicing this specific scenario from other invalid annotations is particularly useful when you want to mute inspection results for non-Rubberduck annotations while still validating the supported ones.
New Quick Fixes
This release also introduces a handful of new quick-fixes:
This fix is now available for ProcedureNotUsed inspection results in standard and document modules; it simply annotates a member with the new
@EntryPoint annotation which specifically instructs ProcedureNotUsed to ignore that member. Use this quick-fix for UDFs and macro procedures that are attached to document objects and don’t need an Excel hotkey. If your project is hosted in an Excel workbook, macros annotated with
@ExcelHotkey are also considered as entry points now.
VariableTypeNotDeclared inspection results could always be “fixed” by making the declared type an explicit
Variant; this new quick-fix makes Rubberduck infer the declared type from usage where possible, which is objectively awesome.
This new quick-fix is available for the new implicit containing workbook/worksheet reference inspections, making the reference to the containing module explicit.
The Write-Only Property inspection gets a new quick-fix with this release; this iteration does not try to infer the backing field, so further manual edits are needed, but it’s a start.
New UI Language: Italian
Thanks to a timely contribution by @PhilCattivocaratere, we are thrilled to announce that this release introduces Italian as a UI language:
In a nutshell
Here’s a quick summary of the most significant pull requests and commits merged this cycle:
- Encapsulate Field enhancements
- We are now leveraging our internal
- We are now building Rubberduck with the latest version of Visual Studio 2019
- Precompiler directives now parse correctly with line continuations
CodeBuilderAPI honors indenter settings when generating code
- Fixed a number of issues with name conflict validation
- Test methods now support a
@TestIgnoreannotation to ignore a test
- Specific projects can now be ignored by the parser
- Users no longer need to accept the GPLv3 as if it were an End User License Agreement (EULA)
- Custom templates extensions is changing from
- Implicit Variant inspection quick-fix will now infer the best type from usage instead of just making the variable an explicit
For...Nextloop variables no longer trigger a variable not used inspection
- Implicit Public Member inspection will now flag
- Branch “master” was renamed to “main”
- New Property Group indenter settings
- Arrays declared with
ReDimnow correctly resolve the declared type
@ModuleDescriptioncan now be used in document modules (cannot be synchronized)
- Documentation strings are now read from annotations when missing from attributes
- Start menu link to website now uses https
- Fixed context menu positioning
@EntryPointannotation marks a standard or document module member as invoked from outside the code; as such the Procedure Not Used inspection will no longer flags members annotated with
- Several other opportunistic fixes left & right, improved overall stability.
- Shiny new splash screen; debug builds now indicate “debug” instead of a meaningless local build number (build version# is controlled by the AppVeyor CI build server; local builds are all .0).
- Expand/collapse all in Code Explorer
- Rubberduck CommandBar label will now show the corresponding parameter declaration for a selected argument, and Find all References will now include arguments at call sites for parameter declarations (previous versions would only count named arguments).
- Find Symbol navigation tool works again.
- Find all References search results will now highlight the target reference in its context.
- Added Italian UI resources.
Possible (Silent) Crash on Exit
I haven’t personally experienced it in a long time in Excel, but Rubberduck may run into issues tearing down, sometimes causing an AccessViolationException when it unloads, which can either crash the host process or leave it hanging as a ghosted process that will interfere with reloading: verify that the host process (e.g. ACCESS.EXE) has shut down completely using Task Manager when you close everything, and make sure to kill any such ghosted processes before loading Rubberduck in a new process.
Sounds familiar? If you’ve been following the project all along, you probably remember similar behavior in earlier releases – at one point during this development cycle we thought the problem was finally under control, but the cure was worse than the disease and there was a chance that the host document / project gets completely corrupted and impossible to open in the VBE: because we think it’s much better to sometimes crash on teardown than to corrupt our users’ host documents forever, we have reverted that “fix” and will have to come up with something else.
Lots of good stuff, including a new peek definition command to the code pane, Code Explorer, and the VBE’s own Project Explorer‘s context menus – the feature was developed too late to make the cut for this release, but will be available in 2.5.2.x pre-release builds very soon:
In the Unit Testing department, a mocking framework is about to debut as an experimental feature with a number of technical limitations.
I’m going to be turning my attention towards code path analysis this cycle; this internal API is needed to implement the more advanced inspection ideas, and an Extract Method refactoring needs it too.
To be continued…