I would like to write down the PDE for the price of an up-and-in call option under the Black-Scholes model as follows. The payoff of the option at expiry $T$ is
$$C_T := \max(S_T-K,0)1_{M_T \geq L}$$
where $M_t = \sup_{u\leq t}S_u$ and $L > K > 0$. The price of the option at time $t < T$ is given by
$$C_t = e^{-r(T-t)}E[\max(S_T-K,0)1_{M_T \geq L}\mid \mathcal{F}_t]$$ where $\mathcal{F}_t = \sigma(S_u: u\leq t)$. It is a well-known fact that the vector-valued process consisting of Brownian motion and its running maximum is Markov. I am assuming that this applies to geometric Brownian motion and its running maximum as well (I haven't checked this though). If that is the case, then $$C_t = f(t,S_t,M_t)$$ for some measurable function $f$. I don't know whether this function is smooth enough to apply Ito's lemma but again assuming that this is the case one obtains $$dC_t = \left(f_t(t,S_t,M_t) + f_S(t,S_t,M_t)rS_t + \frac{1}{2}f_{SS}(t,S_t,M_t)\sigma^2S_t^2\right)dt + f_M(t,S_t,M_t)dM_t + f_S(t,S_t,M_t)\sigma S_tdW_t^Q$$ The terms with $f_{MM}$ and $f_{MS}$ do not appear because $M$ is a continuous non-decreasing process. So its quadration variation as well as its covariation with $S$ are zero.
If $C$ is a self-financing traded asset, then $e^{-rt}C_t$ must be a martingale. This translates to $$f_t(t,S,M) + f_S(t,S,M)rS + \frac{1}{2}f_{SS}(t,S,M)\sigma^2S^2 = rf(t,S,M)$$ and $$f_M(t,S,M) = 0$$ The latter condition kind of makes sense. If $M \geq L$, then the option has become an ordinary vanilla call so at least on $M \geq L$ the pricing function is constant in $M$. If $M < L$, then the barrier is not reached yet but I am not convinced that on $M < L$ $f$ would be constant in $M$. Furthermore, if it were constant, this would induce discontinuity at $M = L$ and I am not sure if Ito's lemma would be applicable in the first place then.
My question is how can I make this approach to pricing of barrier options work? If that is not possible, then I would like to know why and specifically what it is that I am missing which is blocking this path.