A full-wave analysis of microwave integrated circuits in multilayer dielectric media in a rectangular waveguide is described. It combines spectral-domain approach with residue theory and the contour integration method to accurately evaluate the impedance matrix of the method of moments. The S-parameters are obtained by exciting the circuit with a voltage gap generator and applying the matrix pencil technique, or by impressing traveling-wave currents. Modifications on the latter are introduced. Both methods are compared from a physical point-of-view, analytical complexity, and numerical efficiency.