To show: $X:=(1,-\partial_SC)$ is a self-financing portfolio:

$$X\text{ self-financing}\leftrightarrow dX_t=adC_t+bdS_t\,\forall t\geq0$$

Let $C(S_t,t)\in C^2$, then by Ito formula:

$$dC=\partial_tCdt+\partial_sCdS+\frac{1}{2}\sigma^2S_t^2\partial_{SS}Cdt=\partial_SCdS_t+(\partial_tC+\frac{1}{2}\sigma^2S_t^2\partial_{SS}C)dt$$

Let $C(S_t,t)$ satisfy the BS-PDE in discounted form:
$$\partial_tC+\frac{1}{2}\partial_{SS}C\sigma^2S^2=0$$

(Undiscounted form is $\partial_tC+\frac{1}{2}\sigma^2S^2\partial_{SS}C=rC-rS\partial_S C$).

Plugged in:
$$dC=\partial_SCdS$$

So we get:

$$dX=adC+bdS=1dC-\partial_SCdS=\partial_SCdS-\partial_SCdS=0\,\,\forall t$$

So we have a riskless portfolio which satisfies the self-financing condition. (q.e.d.)