  Context: In the early evolution of a planetary system, a pair of planets may
be captured in a mean motion resonance while still embedded in their nesting
circumstellar disk. Aims: The goal is to estimate the direction and amount of
shift in the semimajor axis of the resonance location due to the disk gravity
as a function of the gas density and mass of the planets. The stability of the
resonance lock when the disk dissipates is also tested. Methods: The orbital
evolution of a large number of systems is numerically integrated within a
three-body problem in which the disk potential is computed as a series of
expansion. This is a good approximation, at least over a limited amount of
time. Results: Two different resonances are studied: the 2:1 and the 3:2. In
both cases the shift is inwards, even if by a different amount, when the
planets are massive and carve a gap in the disk. For super--Earths, the shift
is instead outwards. Different disk densities, Sigma, are considered and the
resonance shift depends almost linearly on Sigma. The gas dissipation leads to
destabilization of a significant number of resonant systems, in particular if
it is fast. Conclusions: The presence of a massive circumstellar disk may
significantly affect the resonant behavior of a pair of planets by shifting the
resonant location and by decreasing the size of the stability region. The disk
dissipation may explain some systems found close to a resonance but not locked
in it.
