I am wondering about the barrier in PN junction diode.Due to diffusion negative ions are formed on the P side and Positive ions are formed on the N side of the diode.both opposite sides exert force of attraction and so a line of positive ions and negative ions align along the junction. The question is as free electrons remaining in the N region and also the holes in the P region left behind in the P region.Why these carriers are not attracted so electrons from the N side neutralize the positive ions in the N region and so as the holes in the P region. Why the force is existing between the ions and not between the free electrons and the positive ions. Second my question is why there is a barrier potential? When opposites and equal charges present in the depletion layer should cancel their electrostatic or electric field effect?