Suppose we have the following general problem:
$$ \max_{\theta} \mathbb{E}_{x} \big[ f(x, \theta) \big]$$
where $f(x, \theta)$ is continuously differentiable and bounded in $\theta$. Assume that $\mathbb{E}_{x} \big[ f(x, \theta) \big]$ has no closed-form solution due to the distribution of the random variable $x$, but is known to be concave.
I would like to know under which conditions I can solve the above problem by taking the derivative inside the expectation and set it to zero, i.e.,
$$\mathbb{E}_{x} \bigg[ \frac{d}{d \theta} f(x, \theta) \bigg] = 0.$$