This confuses me.
One easy case of counting is when the decision problem is in $P$ and there are no solutions.
A lecture show that the problem of counting the number of perfect matchings in a bipartite graph (equivalently, counting the number of cycle covers in a directed graph) is $\#P$ -complete.
They give reduction from counting vertex covers of size $k$ to counting cycle covers in a digraph using gadgets.
Theorem 27.1 The number of good cycle covers in $H$ is $(k!)^2$ times the number of vertex covers of $G$ of size $k$.
Using gadget they leave only the "good" cycles.
My understanding of the lecture is that $G$ doesn't have vertex cover of size $k$ iff the transformed digraph $G'$ doesn't have cycle cover. Checking if $G'$ has cycle cover can be done in polynomial time, implying $P=NP$ since we can transform the decision problem to finding solution.
What am I misunderstanding?
The permanent of the adjacency matrix of digraph counts cycle covers and is $\#P$-complete.
The decision problem "Is the permanent of (0,1) matrix zero" is in P since finding cycle cover is in $P$.
$P \ne NP$ implies there is no reduction of counting $NP$-complete problems to counting $(0,1)$-permanent which maps $0 \mapsto 0$.
Edit Related MO question
Added
Markus Bläser
points out that bad cycle are still "there",
but the sum of their weights vanishes.
Appears to me the weight of bad cycle in a widget is zero.
From page 148 (11 of the pdf):
The full adjacency matrix B with submatrices A corresponding to these four-node widgets counts 1 for each good cycle cover in H and 0 for each bad cycle cover
Another question:
Wouldn't maximum weight cycle cover contain only the good cycles, corresponding to a $k$ vertex cover in the original graph?
In CC every vertex must be in exactly one cycle.