  It was established long ago that SO(2) electric-magnetic duality is an {\em
off-shell} symmetry of the free Maxwell theory, i.e., that it leaves invariant
the action and not just the equations of motion. We review here that analysis
and extend it to the Maxwell field coupled to scalar fields defined on the
$SL(2,\mathbb{R})/SO(2)$ coset space, showing that $SL(2,\mathbb{R})$ is in
that case an {\em off-shell} symmetry. We also show how the result can be
generalized to many Maxwell fields and $Sp(2n, \mathbb{R})$ duality symmetry -
or a subgroup of it, recovering in particular the case of maximal supergravity
in four dimensions with $E_{7,7}$ symmetry. We finally indicate further
possible extensions to twisted self-duality equations for $p$-forms, including
Chern-Simons terms and Pauli couplings, as well as linearized gravity, which
will be treated in depth elsewhere.
