Look at the curve of your integral

Your integral is the red one, and the closed curve is the red one plues the green one. The point is that the green one is a integral only over $\displaystyle x$ because $\displaystyle y=0$ along that line, so you can apply Green's theorem to the **closed** (red + green) curve. As you have said it gives $\displaystyle 0$ but what it is $\displaystyle 0$ is the integral along the closed curve, not the one you asked. So:

$\displaystyle \oint e^x\cos(y)dx-e^{x}sin(y)dy=\int \left( -\frac{\partial}{\partial x}e^{x}sin(y)-\frac{\partial}{\partial y}e^{x}cos(y)\right)dxdy=0$

Now I denote $\displaystyle R$ the red curve and $\displaystyle G$ the green one, so that:

$\displaystyle \oint Mdx+Ndy=\int_{R} Mdx+Ndy+\int_{G} Mdx+Ndy$

Note that both the integral in $\displaystyle R$ and $\displaystyle G$ are line integrals!

In particular, the $\displaystyle G$ is a easy line integral, the usual integral over some interval in $\displaystyle \mathbb{R}$