Changing order of integration to get a finite value? Let's say we have a function $f(x,y)$ for which the definite integral
$$\int_{0}^{\infty}dxf(x,y)$$
is divergent for all $y\in\mathbb{R}$. Maybe to make things more well defined, we assume
$$\int_{0}^{M}dxf(x,y)\sim M^D$$
as $M\to\infty$, for some positive integer $D$. Assume the function
$$F(x)=\int_0^{\infty}dyf(x,y)$$
is finite for all $x$. Under what conditions is it possible that the integral
$$\int_{0}^{\infty}dxF(x)$$
converges? Is it possible at all? If so it would be nice to see and explicit example!
 A: The Fubini-Tonelli Theorems give conditions under which this cannot happen, in the context of the Lebesgue integral.  That is, these theorems provide conditions under which
$$ \iint_{X\times Y} f(x,y) \,\mathrm{d}(x,y)
 = \int_{X} \left( \int_{Y} f(x,y) \,\mathrm{d}y \right)\, \mathrm{d}x
 = \int_{Y} \left( \int_{X} f(x,y) \,\mathrm{d}x \right)\, \mathrm{d}y.$$
In looking for example of functions where this does not hold, it may be helpful to think about when the hypotheses of these theorems fail (and then try to reinterpret the result in terms of the Riemann integral, which seems to be the context of the original question).

It is unlikely that you are going to come up with a complete set of conditions such that the desired result holds.  However, it is possible to construct examples.  One such is the following:
Define the function $g : \mathbb{R} \to \mathbb{R}$ by the formula
$$
g(x) = \begin{cases}
\dfrac{1}{\lfloor x \rfloor + 1}, & \text{if there is some $m\in\mathbb{N}$ such that $2m \le x < 2m+1$, and} \\[2ex]
-\dfrac{1}{\lfloor x \rfloor}, & \text{if there is some $m\in\mathbb{N}$ such that $2m+1\le x < 2m$.}
\end{cases}
$$
Focusing more on intuition, $g$ is constant on intervals of the form $[n,n+1)$.  If $n$ is even, then $g$ is positive; and if $n$ is odd, then $g$ is negative.  The values which $g$ takes are arranged such that
$$ \int_{2m}^{2m+2} g(x) \,\mathrm{d}x = 0 $$
for any natural number $m$, and the values decay to zero, ensuring that
$$ \int_{0}^{\infty} g(x) \,\mathrm{d}x = 0. $$
Define $f(x,y) = g(x)$.  Then for any fixed $y$
$$ \int_{0}^{\infty} f(x,y) \,\mathrm{d}x
= \int_{0}^{\infty} g(x)\, \mathrm{d}x
= 0, $$
but for any fixed $x$
$$ \int_{0}^{\infty} f(x,y) \,\mathrm{d} y
= \int_{0}^{\infty} (\text{constant}) \,\mathrm{d}y
= \pm \infty.
$$
This constant will be of the form $1/(\lfloor x\rfloor +1)$ or $-1/\lfloor x \rfloor$, depending on the fixed value of $x$.  In any case, the constant will be nonzero, and so the integral will diverge (in particular, in the setting of the question, the integral $\int_{0}^{M} f(x,y)\,\mathrm{d}y$ will be asymptotically equivalent to $M = M^1$).
Now define
$$ F(y) = \int_{0}^{\infty} f(x,y)\,\mathrm{d} x.  $$
Note that $F(y) = 0$ for all $y$, and so
$$ \int_{0}^{\infty} F(y) \,\mathrm{d}y = 0. $$

More generally, choose any two functions $g,h : [0,\infty) \to \mathbb{R}$ such that $g(x) \ne 0$ for any $x$ and
$$ \int_{0}^{\infty} g(x)\,\mathrm{d}x = 0
\qquad\text{and}\qquad
\int_{0}^{M} h(y) \,\mathrm{d}y \sim M^D. $$
Then define $f(x,y) = g(x)h(y)$.  For any fixed $x$,
$$
\int_{0}^{M} f(x,y)\,\mathrm{d}y
= g(x) \int_{0}^{M} h(y)\,\mathrm{d}y
\sim M^D.
$$
On the other hand, for any fixed $y$,
$$ F(y) := \int_{0}^{\infty} f(x,y)\,\mathrm{d}x = h(y) \int_{0}^{\infty} g(x)\,\mathrm{d}x = 0, $$
which implies that
$$ \int_{0}^{\infty} F(y)\,\mathrm{d}y = 0. $$

NB:  I seem to have reversed the roles of $x$ and $y$ in my answer.  Replace all occurrences of the variable $x$ with $y$, and vice versa, in order to recover the notation of the question.
