Skip to content

Bug: efc-dead-code-and-latent-nre-traps #466

Closed

Description

@drmoisan
  • Work Mode: full-bug

Summary

EfcViewer.SetController is never called, so EfcViewer._formController is permanently null and
EditFiltersMenuItem_Click carries a latent NullReferenceException that a routine Designer
regeneration would arm. Several other EFC members and one orphaned file are dead code.

Environment

  • OS/version: Windows 11 Pro 10.0.26200
  • Runtime: .NET Framework 4.8.1 WinForms VSTO add-in
  • UI path: QuickFiler/Viewers/EfcViewer.cs, QuickFiler/Controllers/EfcItemController.cs
  • Data source or fixture: n/a

Steps to Reproduce

The trap is currently unreachable by design; it is armed by a maintenance action:

  1. Open EfcViewer in the Visual Studio Designer and re-generate EfcViewer.Designer.cs, or otherwise
    wire EditFiltersMenuItem.Click to EfcViewer.EditFiltersMenuItem_Click.
  2. Open the Email Filer viewer and choose the Edit Filters menu item.
  3. Observe NullReferenceException.

Expected Behavior

Either the controller is wired into the viewer so the Edit Filters command works, or the dead member
and its unreachable handler are removed so no trap remains.

Actual Behavior

A - dead SetController, permanently null field. EfcViewer.cs:50-53 declares
internal void SetController(EfcFormController controller). A repository-wide search for
SetController finds call sites only in QfcFormController.cs:44, QfcFormViewer.cs:46,
QfcFormViewerDark.cs:31, QfcFormViewerExpanded.cs:31, and the non-compiled Legacy/ and
EfcViewer3.cs files. EfcFormController never calls it, unlike its QFC twin. Consequently
EfcViewer._formController (EfcViewer.cs:48) is always null and
EfcViewer.EditFiltersMenuItem_Click (EfcViewer.cs:157-160) would throw.

The handler is currently unreachable: EfcViewer.Designer.cs never wires EditFiltersMenuItem.Click.
Verified - across 4,277 lines the only references are the declaration at :67, the DropDownItems
add at :4123, three property assignments at :4136-4138, and the field at :4275. There is no
+= at all. So this is dead code carrying a latent trap, not a live crash.

B - zero-call-site members in EfcItemController. InitializeWebView() (:174-205) and
RegisterActions(...) (:680-692) have no call sites repo-wide (verified by grep across QuickFiler/
and QuickFiler.Test/). _selectorsCtrls (:381) is initialized to null and never assigned before
being passed to SetupThemes as the selectors argument (:97, :144).

C - unused constructor overload. The EfcItemController
(globals, homeController, parent, itemViewer, dataModel, bool async, token) overload (:44-57) has
zero call sites; only the 6-argument (:30) and 5-argument (:59) forms are used, by
EfcFormController.cs:87 and :69.

D - orphaned uncompiled files. QuickFiler/Viewers/EfcViewer3.cs and its siblings are present in
the working tree but carry no <Compile Include> entry in QuickFiler/QuickFiler.csproj. EfcViewer3.cs
nonetheless carries an [ExcludeFromCodeCoverage] attribute at :17, which is misleading - an
uncompiled file needs no exemption.

Logs / Screenshots

  • Attached minimal logs or screenshot
  • Code-read evidence recorded above (verified 2026-08-07 against the working tree).

Impact / Severity

  • Blocker
  • High
  • Medium
  • Low

Nothing fails today. The severity is the maintenance trap: the Edit Filters command is silently
non-functional, and the natural act of re-wiring it in the Designer converts that into a crash.

Source

From: docs/features/potential/2026-08-07-efc-dead-code-and-latent-nre-traps.md

Activity

  1. added a commit that references this issue on Aug 28, 2026
  2. drmoisan commented on Aug 31, 2026

    @drmoisan
    OwnerAuthor

    Closing as completed. Delivered under efc-controller-surface-defects-464, across two commits — 345f6848 ("remove dead EfcViewer surface and EfcViewer3 orphans (#466 A/D)") and 5d567e7e ("remove dead EfcItemController surface (#459, #464 D, #466 B/C)") — merged via PR #661 (merge commit ee7d0ec4), both ancestors of origin/main. The remedy for all four sub-defects was deletion of the dead code, rather than wiring it live.

    All four confirmed directly against origin/main:

    • A (dead SetController). EfcViewer.cs no longer declares SetController or the _formController field; EditFiltersMenuItem_Click is gone. (The live Edit Filters route through EfcFormController is unaffected and unchanged.)
    • B (zero-call-site members). EfcItemController.cs no longer declares RegisterActions or InitializeWebView (zero occurrences of either); the async initializer that remains, InitializeWebViewAsync, has confirmed call sites.
    • C (unused constructor overload). EfcItemController now declares exactly two constructors — the 6-argument and 5-argument forms — with no 7-parameter overload.
    • D (orphaned uncompiled files). QuickFiler/Viewers/EfcViewer3.cs and its .Designer.cs/.resx siblings are absent from the working tree.

    All corresponding acceptance criteria in docs/features/active/efc-controller-surface-defects-464/spec.md are checked [x], including the reflection-based tests pinning each removed member's absence.

    Verified during an admission check against the bugs-638-644-647 parallel run (2026-09-01). No branch or PR remains to ship; this was left open only as bookkeeping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions