Double integral involving the derivative of the Dirac delta function Consider the double integral
\begin{equation}
I=\int^\infty_{-\infty}dx\int^\infty_{-\infty}dy f(x)\left[\frac{\partial}{\partial x}\delta(x-y)\right]g(y)
\end{equation}
I'm not sure which of the following two ways to calculate it is the correct one:

*

*$I=\int^\infty_{-\infty}dx\int^\infty_{-\infty}dy f(x)\left[\frac{\partial}{\partial x}\delta(x-y)\right]g(y)=\int^\infty_{-\infty}dx\int^\infty_{-\infty}dy f(x)\frac{\partial}{\partial x}\left[\delta(x-y)g(y)\right]$
$=\int^\infty_{-\infty}dx f(x)\frac{\partial}{\partial x}\left[\int^\infty_{-\infty}dy\delta(x-y)g(y)\right]=\int^\infty_{-\infty}dx f(x)\frac{\partial}{\partial x}g(x)$.

*Using the relation $\frac{\partial}{\partial x}\delta(x-y)=-\frac{\partial}{\partial y}\delta(x-y)$ and integrating by part, then
$I=\int^\infty_{-\infty}dxf(x)\int^\infty_{-\infty}dy \left[-\frac{\partial}{\partial y}\delta(x-y)\right]g(y)$
$=\int^\infty_{-\infty}dxf(x) \left[-\delta(x-y)g(y)\right]|^{y=\infty}_{y=-\infty}-\int^\infty_{-\infty}dxf(x)\int^\infty_{-\infty}dy \left[-\frac{\partial}{\partial y}g(y)\right]\delta(x-y)$
$= \left[-f(y)g(y)\right]|^{y=\infty}_{y=-\infty}+\int^\infty_{-\infty}dxf(x)\frac{\partial}{\partial x}g(x)$.

We see that method 2 gives an extra boundary term compared with the result of method 1.
 A: Let's discuss the object in the original post that is denoted by
$$\int_{-\infty}^\infty \int_{-\infty}^\infty f(x)\frac{\partial \delta(x-y)}{\partial x}g(y)\,dy\,dx\tag1$$
We see the presence of the Dirac Delta $\delta$ appearing in this expression.  However, the Dirac Delta is not a function.  Rather, it is a Generalized Functions, also known as a Distribution.
Distributions are linear Functionals that map test functions in the space $C_C^\infty$ (infinitely differentiable functions with compact support) into numbers.  For the Dirac Delta, the functional definition is given as
$$\langle \delta_a, f\rangle =f(a) $$
where $f\in C_C^\infty$.
Now, the interior integral notation you've used in $(1)$ is only notation.  The object denoted by that interior integral is the linear functional
$$\underbrace{\int_{-\infty}^\infty \frac{\partial \delta(x-y)}{\partial x}g(y)\,dy}_{\text{Notation only}}\equiv \frac{d}{dx}\langle \delta_x,g\rangle =g'(x)$$
where $f\in C_C^\infty$ and $g\in C_C^\infty$.  Therefore we find that
$$\begin{align}
\int_{-\infty}^\infty f(x)\frac{d}{dx}\left(\langle \delta_x,g\rangle\right)\,dx&=\int_{-\infty}^\infty f(x)g'(x)\,dx\tag2
\end{align}$$


ALTERNATIVE DERIVATION
The distributional derivative of the Dirac Delta (the unit doublet), denoted $\delta_a'$,is defined as
$$\langle \delta_a,f\rangle=-\langle \delta_a,f'\rangle =-f'(a)$$
for any test function $f\in C_C^\infty$.
We could have interpreted the object in $(1)$ to mean
$$\int_{-\infty}^\infty g(y) \langle \delta_y',f \rangle\,dy$$
for both $f$ and $g$ in $C_C^\infty$.
Then, in this case, we have
$$\int_{-\infty}^\infty g(y) \langle \delta_y',f \rangle\,dy=-\int_{-\infty}^\infty g(y) f'(y)\,dy
\tag3$$
whereupon integrating the integral on the right-hand side of $(3)$ by parts with $u=g(y)$ and $v=f(y)$ we find that
$$-\int_{-\infty}^\infty g(y) f'(y)\,dy=-\left.\left(f(y)g(y)\right)\right|_{-\infty}^\infty+\int_{-\infty}^\infty f(y)g'(y)\,dy\tag4$$
Inasmuch as $f$ and $g$ have compact support, they vanish for $|x|>L$ for some $L$ and hence the first term on the right-hand side of $(4)$ is identically $0$.  Hence, replacing the dummy integration variable $y$ with $x$, we find that
$$\int_{-\infty}^\infty g(y) \langle \delta_y',f \rangle\,dy=\int_{-\infty}^\infty f(x)g'(x)\,dx$$
which agrees with the result in $(2)$.
A: The Dirac delta and its derivatives only play nice with functions (& distributions) in $C_C^\infty$, and these satisfy$$\lim_{y\to\pm\infty}f(y)=\lim_{y\to\pm\infty}g(y)=0,$$so$$\left.[-\delta(x-y)g(y)]\right|_{y=-\infty}^{y=\infty}=0,\,\left.[-f(y)g(y)]\right|_{y=-\infty}^{y=\infty}=0.$$
