Přeskočit obsah

PQ0005 — One status poll per Thing type

More than one status poll serves the same Thing type.

public sealed class PanelPoller(Protocol protocol) : IStatusPoller<Panel> { ... }

// reported — a second poll for Panel
public static class StatusPolling
{
    public static Task PollStatus(Panel panel, Protocol protocol, CancellationToken ct) => ...;
}

Any two of these for one Thing type are reported:

  • a class implementing IStatusPoller<TThing>,
  • a static PollStatus method whose first parameter is TThing,
  • IPollableStatus implemented by hand on TThing.

Why the build refuses this

The scheduler runs one poll per Thing. With two polls it is undefined which one runs, and the other one silently never does. A half-finished move from a static PollStatus to IStatusPoller is the usual cause.

How to fix it

Keep exactly one IStatusPoller<TThing>. Move the work of the other polls into it and delete them. If two pollers read different parts of the device, call both parts from one poller.

If you disagree with a report

Do not suppress it. A wrong report is a bug in the check — report it with the code that triggered it.