Hello i don`t have the complete answer but i would like to state two points:
first heat capacity is typically measured in temperature regions where no transition takes place and therefore the classical approaches are valid. In the region where transitions take place the definition is not so easy and therefore the evaluation should be taken with care.
But nevertheless if you apply your classical evaluatio for axample to a step like increase of e.g. DSC-curve you will not get an infinite slope as the transition does not take place at a sharp temperatur but over a broad temperature range. Therefore your heat capacity will have an finite value.
The classical and legitimate definition heat capacity involve differentiability of thermodynamics energy or the enthalpy with respect to temperature under the constant volume, Cv or pressure, Cp without any further constrain. Therefore one doesn't have any problem for the so-called second order phase transition.
Actually, if one employs generalized function such as Heaviside step functions to represent enthalpy or energy for example still one define Cp & Cv in terms of Dirac Delta functions as follows:
H(T,P) = Ha(TTo,P), where Hf is enthapy of fusion.