How can we find the integral $\displaystyle \int_{0}^{\pi}\cos{x}\sin{x}\,{dx}$ with the substitution $\displaystyle u = sinx$?

I know how to find the integral, but the limits become the same sin(0) = sin(pi) = 0.

What should I do in general when a given substitution makes upper bound = lower bound?