[MOVED HERE FROM MSE.]

The statement of the Grothendieck-Lefschetz fixed point theorem is well-known. For a proper algebraic variety $X$ over $\mathbb F_q$, $$\#X(\mathbb F_q) =\sum_i (−1)^i Tr(Fr_X, H^i_c(X, \mathbb Q_l)).$$ Also known is the version for general constructible l-adic sheaves $\mathcal F$: $$\sum_{x\in X(\mathbb F_q)} Tr(Fr_x,\mathcal F_x)=\sum_i (−1)^i Tr(Fr_X, H^i_c(X, \mathcal F)).$$ Thirdly, K. Behrend proved an analog for the first formula in the context of algebraic stacks (replacing the scheme $X$ by a Noetherian algebraic stack $\mathcal X$).

Now my question is: is there a version of the second formula for an algebraic stack $\mathcal X$ (with nice hypotheses if necessary)?

It would seem natural, since the second formula is a generalization of the first, and the first is true in the context of algebraic stacks by Behrend's work. However, the second formula does not follow directly from the first in the case of schemes (as far as I know: I would be glad if it were true!), so I am not in the position to easily extend the proof of the second formula in the more general context of stacks.

Thank you in advance.

ADDED QUESTION: Moreover, why is the sum on the left of the second formula finite when the scheme (or stack) is not of finite type? Behrend speaks about this problem, but I do not find where he solves it, if he does.